zhangchunrui 1 month ago
parent
commit
2935db5635
1 changed files with 13 additions and 12 deletions
  1. 13 12
      index.mjs

+ 13 - 12
index.mjs

@@ -290,21 +290,22 @@ async function processTradePair() {
   })
 
   console.log(`其中 ${unsentTradePair.length} 个未发送过`)
-  if (firstRun) {
+  if (!firstRun) {
     firstRun = false
-    return
-  }
-  // 发送到 Discord
-  for (const pair of unsentTradePair) {
-    const success = await sendToDiscordTradePair(pair)
-    if (success) {
-      sentTradePair.add(pair.poolAddress)
+    // 发送到 Discord
+    for (const pair of unsentTradePair) {
+      const success = await sendToDiscordTradePair(pair)
+      if (success) {
+        sentTradePair.add(pair.poolAddress)
+      }
+      // 避免发送过快,稍微延迟
+      await new Promise((resolve) => setTimeout(resolve, 500))
     }
-    // 避免发送过快,稍微延迟
-    await new Promise((resolve) => setTimeout(resolve, 500))
+  
+    console.log(`处理完成,已发送 ${unsentTradePair.length} 个交易对`)
+  } else {
+    console.log('第一次运行,不发送交易对')
   }
-
-  console.log(`处理完成,已发送 ${unsentTradePair.length} 个交易对`)
 }
 
 // 启动定时任务