github-actions[bot] commited on
Commit
ed57b37
·
1 Parent(s): 941e70c

Update from GitHub Actions

Browse files
functions/utils/emailVerification.ts CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
  export async function getVerificationCode(proofApi: string, apiKey: String, proofEmail: string, timestamp: number): Promise<string> {
4
  const maxRetries = 30;
5
  console.log(`开始获取验证码${proofApi},${apiKey},${timestamp},${new Date(timestamp * 1000)}`);
@@ -31,10 +29,14 @@ export async function getVerificationCode(proofApi: string, apiKey: String, proo
31
  console.log(proofEmail, `获取验证码失败: ${await response.text()}`);
32
  }
33
  await new Promise(resolve => setTimeout(resolve, 2000));
34
- } catch (error) {
 
35
  if (i === maxRetries - 1) {
36
  throw new Error("Failed to get verification code after maximum retries");
37
  }
 
 
 
38
  }
39
  }
40
  throw new Error("Failed to get verification code");
 
 
 
1
  export async function getVerificationCode(proofApi: string, apiKey: String, proofEmail: string, timestamp: number): Promise<string> {
2
  const maxRetries = 30;
3
  console.log(`开始获取验证码${proofApi},${apiKey},${timestamp},${new Date(timestamp * 1000)}`);
 
29
  console.log(proofEmail, `获取验证码失败: ${await response.text()}`);
30
  }
31
  await new Promise(resolve => setTimeout(resolve, 2000));
32
+ } catch (error:any) {
33
+ console.error(proofEmail, `获取验证码出错: ${error.message}`);
34
  if (i === maxRetries - 1) {
35
  throw new Error("Failed to get verification code after maximum retries");
36
  }
37
+ // 错误后等待3秒再重试
38
+ await new Promise(resolve => setTimeout(resolve, 3000));
39
+ continue;
40
  }
41
  }
42
  throw new Error("Failed to get verification code");