New task
CI/CD로 배포 시작됐습니다. **원인 및 수정 내용:** **버그:** `solveCaptcha()`가 "TOO FREQUENT" 에러를 던지면 catch에서 **즉시 return**해서 재시도 루프를 탈출했음 **수정:** - TOO FREQUENT 에러 감지 시 → **10초 대기 후 재시도** (최대 5회까지) - 재시도 간 기본 딜레이: 2초 → **3초** - 쿠폰 간 딜레이: 3초 → **5초** (연속 쿠폰 처리 시 WOS 서버 부하 감소)
This commit is contained in:
parent
9d133ab21e
commit
357d6dc911
@ -116,14 +116,20 @@ export class WosService {
|
|||||||
): Promise<{ success: boolean; message: string; err_code?: number }> {
|
): Promise<{ success: boolean; message: string; err_code?: number }> {
|
||||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||||
if (attempt > 1) {
|
if (attempt > 1) {
|
||||||
await new Promise((r) => setTimeout(r, 2000));
|
await new Promise((r) => setTimeout(r, 3000));
|
||||||
}
|
}
|
||||||
|
|
||||||
let captchaCode: string;
|
let captchaCode: string;
|
||||||
try {
|
try {
|
||||||
captchaCode = await this.solveCaptcha(fid);
|
captchaCode = await this.solveCaptcha(fid);
|
||||||
} catch (err: any) {
|
} 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();
|
const ts = this.now();
|
||||||
@ -187,7 +193,7 @@ export class WosService {
|
|||||||
await this.couponLogRepo.save({ fid, coupon_code: coupon.code, result_msg: result.message });
|
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 });
|
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;
|
return results;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user