(targetRun, totalRuns, nextAttemptRun, options = {})
| 188 | } |
| 189 | |
| 190 | async function waitBeforeAutoRunRetry(targetRun, totalRuns, nextAttemptRun, options = {}) { |
| 191 | const { autoRunSkipFailures = false, roundSummaries = [] } = options; |
| 192 | const fallbackThreadIntervalMinutes = normalizeAutoRunFallbackThreadIntervalMinutes( |
| 193 | (await getState()).autoRunFallbackThreadIntervalMinutes |
| 194 | ); |
| 195 | if (fallbackThreadIntervalMinutes <= 0) { |
| 196 | return false; |
| 197 | } |
| 198 | |
| 199 | await addLog( |
| 200 | `线程间隔:等待 ${fallbackThreadIntervalMinutes} 分钟后开始第 ${targetRun}/${totalRuns} 轮第 ${nextAttemptRun} 次尝试。`, |
| 201 | 'info' |
| 202 | ); |
| 203 | await persistAutoRunTimerPlan({ |
| 204 | kind: AUTO_RUN_TIMER_KIND_BEFORE_RETRY, |
| 205 | fireAt: Date.now() + fallbackThreadIntervalMinutes * 60 * 1000, |
| 206 | currentRun: targetRun, |
| 207 | totalRuns, |
| 208 | attemptRun: nextAttemptRun, |
| 209 | autoRunSkipFailures, |
| 210 | roundSummaries, |
| 211 | countdownTitle: '线程间隔中', |
| 212 | countdownNote: `第 ${targetRun}/${totalRuns} 轮第 ${nextAttemptRun} 次尝试即将开始`, |
| 213 | }, { |
| 214 | autoRunSkipFailures, |
| 215 | autoRunRoundSummaries: serializeAutoRunRoundSummaries(totalRuns, roundSummaries), |
| 216 | }); |
| 217 | runtime.set({ autoRunActive: false }); |
| 218 | return true; |
| 219 | } |
| 220 | |
| 221 | async function handleAutoRunLoopUnhandledError(error) { |
| 222 | const currentRuntime = runtime.get(); |
no test coverage detected