Conversation
There was a problem hiding this comment.
Code Review
This pull request updates k6/11-vacancy-test.js to parse REMAIN_ID as an integer in a POST request payload and replaces performance.now() with Date.now() to accommodate the k6 v2 runtime. The reviewer pointed out that REMAIN_ID is already parsed as a number during initialization, making the inline parseInt redundant and inefficient inside the performance-critical subscribe function, and suggested reverting this change.
| const res = http.post( | ||
| `${BASE_URL}/api/v1/vacancy`, | ||
| JSON.stringify({ remainId: REMAIN_ID }), | ||
| JSON.stringify({ remainId: parseInt(REMAIN_ID, 10) }), |
There was a problem hiding this comment.
⚠️ 중복 타입 변환 및 성능 개선 필요
REMAIN_ID는 이미 파일 상단(159번 라인)에서 Number(__ENV.REMAIN_ID || 0)를 통해 숫자 타입으로 변환되어 정의되어 있습니다.
또한, subscribe() 함수는 부하 테스트 실행 시 반복적으로 호출되는 핵심 루프(Hot Path)입니다. 매 요청마다 parseInt를 호출하는 것은 불필요한 오버헤드를 발생시킵니다.
만약 정수 파싱이 반드시 필요하다면, 매 요청마다 변환하는 대신 159번 라인의 초기화 시점에서 parseInt를 수행하고, 여기서는 이미 변환된 REMAIN_ID 상수를 그대로 사용하는 것이 성능과 가독성 측면에서 훨씬 효율적입니다.
| JSON.stringify({ remainId: parseInt(REMAIN_ID, 10) }), | |
| JSON.stringify({ remainId: REMAIN_ID }), |
📢 기능 설명
필요시 실행결과 스크린샷 첨부
연결된 issue
연결된 issue를 자동을 닫기 위해 아래 {이슈넘버}를 입력해주세요.
close #{이슈넘버}
✅ 체크리스트