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;