개발/이슈 처리
-
비동기 api 요청이 동기적으로 작동할 때 (ASP.NET SessionState 접근 문제)개발/이슈 처리 2024. 3. 13. 18:53
세 줄 요약: 1. 브라우저 자바스크립트에서 비동기 api 요청을 했는데 동기적으로 응답이 도착했다. 2. 왜 그런가 봤더니 ASP.NET 서버는 기본적으로 세션 동시 접근을 막기 위해 SessionID가 동일한 요청들에 lock을 걸어 직렬화(serialized)하고 있었던 것. 3. 동일한 세션에서 발생하는 동시다발적 요청의 비동기 처리가 필요하다면 해당 컨트롤러에 `[SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]`를 걸어주자. 저희 DB에는 사이트 이용자의 여정을 기록한 로그 테이블이 있습니다. 그 로그를 가져와서 보여주는 기능을 구현하고 있었는데요. 많은 데이터를 가져오다 보니 api 호출의 응답이 1~2초 정도 걸리는 ..
-
Safari Invalid Date 문제 (new Date()에 공백 파싱 이슈)개발/이슈 처리 2024. 1. 2. 15:07
광고 세부 내역 페이지의 날짜 부분에 NaN (not a number) 오류가 있다는 이슈가 올라왔습니다. 뭘까 싶어서 해당 페이지에 접속해 봤는데 잘 나옵니다. 사파리에서 접속하면 그렇게 된다길래 들어가 봤더니, 과연 일수가 표기되어야 할 곳에 NaN이 나오네요. 뜯어보니 `new Date`에 들어가는 문자열 양식이 문제였습니다. '`2024-01-02 `' 이런 식으로 끝에 공백 하나가 들어가 있었어요. 이게 크롬이나 다른 브라우저에서는 파싱이 잘 되는데, Safari에서는 파싱을 못하고 `Invalid Date`를 띄웁니다. 그러니 해당 문자열로 숫자 계산을 하려고 하면 JS는 `NaN`을 내뱉겠죠. 크롬은 알아서 trim해서 파싱을 해주는 것 같은데, 사파리는 엄격한 기준을 갖고 있는 것 같네..