From 357d6dc911be59bcbd7d7b752234233016364adc Mon Sep 17 00:00:00 2001 From: hyoseung930 <35983843+hyoseung930@users.noreply.github.com> Date: Tue, 19 May 2026 17:54:58 +0900 Subject: [PATCH] New task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI/CD로 배포 시작됐습니다. **원인 및 수정 내용:** **버그:** `solveCaptcha()`가 "TOO FREQUENT" 에러를 던지면 catch에서 **즉시 return**해서 재시도 루프를 탈출했음 **수정:** - TOO FREQUENT 에러 감지 시 → **10초 대기 후 재시도** (최대 5회까지) - 재시도 간 기본 딜레이: 2초 → **3초** - 쿠폰 간 딜레이: 3초 → **5초** (연속 쿠폰 처리 시 WOS 서버 부하 감소) --- back/src/wos/wos.service.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/back/src/wos/wos.service.ts b/back/src/wos/wos.service.ts index 02cfe31..095f892 100644 --- a/back/src/wos/wos.service.ts +++ b/back/src/wos/wos.service.ts @@ -116,14 +116,20 @@ export class WosService { ): Promise<{ success: boolean; message: string; err_code?: number }> { for (let attempt = 1; attempt <= maxRetries; attempt++) { if (attempt > 1) { - await new Promise((r) => setTimeout(r, 2000)); + await new Promise((r) => setTimeout(r, 3000)); } let captchaCode: string; try { captchaCode = await this.solveCaptcha(fid); } catch (err: any) { - return { success: false, message: `캡차 오류: ${err.message}` }; + const msg: string = err.message || ''; + if (msg.includes('TOO FREQUENT') && attempt < maxRetries) { + this.logger.warn(`[${fid}] 캡차 TOO FREQUENT (${attempt}회), 10초 대기 후 재시도`); + await new Promise((r) => setTimeout(r, 10000)); + continue; + } + return { success: false, message: `캡차 오류: ${msg}` }; } const ts = this.now(); @@ -187,7 +193,7 @@ export class WosService { await this.couponLogRepo.save({ fid, coupon_code: coupon.code, result_msg: result.message }); results.push({ name: coupon.name, code: coupon.code, status, message: result.message }); - await new Promise((r) => setTimeout(r, 3000)); + await new Promise((r) => setTimeout(r, 5000)); } return results;