fix: retry indefinitely on captcha OCR failure with 30s delay
All checks were successful
Build and Deploy / deploy-front (push) Successful in 7s
Build and Deploy / deploy-back (push) Successful in 22s

This commit is contained in:
hyoseung 2026-05-19 18:19:40 +09:00
parent 2227233dde
commit d28e85d821

View File

@ -113,9 +113,11 @@ export class WosService {
fid: string, fid: string,
code: string, code: string,
): Promise<{ success: boolean; message: string; err_code?: number }> { ): Promise<{ success: boolean; message: string; err_code?: number }> {
for (let attempt = 1; attempt <= 2; attempt++) { let attempt = 0;
while (true) {
attempt++;
if (attempt > 1) { if (attempt > 1) {
this.logger.warn(`[${fid}] ${code} 캡차 오인식, 30초 대기 후 재시도`); this.logger.warn(`[${fid}] ${code} 캡차 오인식 (${attempt - 1}회), 30초 대기 후 재시도`);
await new Promise((r) => setTimeout(r, 30000)); await new Promise((r) => setTimeout(r, 30000));
} }
@ -138,15 +140,13 @@ export class WosService {
this.logger.log(`[${fid}] ${code} attempt=${attempt} captcha=${captchaCode} → code=${data.code} err=${data.err_code} msg=${data.msg}`); this.logger.log(`[${fid}] ${code} attempt=${attempt} captcha=${captchaCode} → code=${data.code} err=${data.err_code} msg=${data.msg}`);
if (data.code === 0) return { success: true, message: SUCCESS_MSG }; if (data.code === 0) return { success: true, message: SUCCESS_MSG };
if (data.err_code === 40103 && attempt < 2) continue; if (data.err_code === 40103) continue;
return { return {
success: false, success: false,
message: data.msg || `실패 (${data.err_code})`, message: data.msg || `실패 (${data.err_code})`,
err_code: data.err_code, err_code: data.err_code,
}; };
} }
return { success: false, message: '알 수 없는 오류' };
} }
async redeemAll(fid: string) { async redeemAll(fid: string) {