(options = {})
| 4061 | } |
| 4062 | |
| 4063 | async function cancelScheduledAutoRun(options = {}) { |
| 4064 | const state = await getState(); |
| 4065 | const plan = getPendingAutoRunTimerPlan(state); |
| 4066 | if (!plan || plan.kind !== AUTO_RUN_TIMER_KIND_SCHEDULED_START) { |
| 4067 | return false; |
| 4068 | } |
| 4069 | |
| 4070 | autoRunCurrentRun = 0; |
| 4071 | autoRunTotalRuns = plan.totalRuns; |
| 4072 | autoRunAttemptRun = 0; |
| 4073 | await broadcastAutoRunStatus( |
| 4074 | 'idle', |
| 4075 | { |
| 4076 | currentRun: 0, |
| 4077 | totalRuns: plan.totalRuns, |
| 4078 | attemptRun: 0, |
| 4079 | }, |
| 4080 | { |
| 4081 | autoRunRoundSummaries: [], |
| 4082 | autoRunTimerPlan: null, |
| 4083 | scheduledAutoRunPlan: null, |
| 4084 | } |
| 4085 | ); |
| 4086 | await clearAutoRunTimerAlarm(); |
| 4087 | if (options.logMessage !== false) { |
| 4088 | await addLog(options.logMessage || '已取消自动运行倒计时计划。', 'warn'); |
| 4089 | } |
| 4090 | return true; |
| 4091 | } |
| 4092 | |
| 4093 | async function restoreAutoRunTimerIfNeeded() { |
| 4094 | const state = await getState(); |
no test coverage detected