MCPcopy Index your code
hub / github.com/QLHazyCoder/FlowPilot / restoreAutoRunTimerIfNeeded

Function restoreAutoRunTimerIfNeeded

background.js:4093–4129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4091}
4092
4093async function restoreAutoRunTimerIfNeeded() {
4094 const state = await getState();
4095 const plan = getPendingAutoRunTimerPlan(state);
4096 if (!plan) {
4097 if (state.autoRunPhase === 'scheduled' || state.autoRunPhase === 'waiting_interval') {
4098 await clearAutoRunTimerAlarm();
4099 await broadcastAutoRunStatus('idle', {
4100 currentRun: 0,
4101 totalRuns: 1,
4102 attemptRun: 0,
4103 }, {
4104 autoRunRoundSummaries: [],
4105 autoRunTimerPlan: null,
4106 scheduledAutoRunPlan: null,
4107 });
4108 }
4109 return;
4110 }
4111
4112 if (plan.fireAt <= Date.now()) {
4113 await launchAutoRunTimerPlan('restore');
4114 return;
4115 }
4116
4117 const statusPayload = getAutoRunTimerStatusPayload(plan);
4118 await broadcastAutoRunStatus(
4119 statusPayload.phase,
4120 statusPayload,
4121 {
4122 autoRunSkipFailures: plan.autoRunSkipFailures,
4123 autoRunRoundSummaries: serializeAutoRunRoundSummaries(plan.totalRuns, plan.roundSummaries),
4124 autoRunTimerPlan: plan,
4125 scheduledAutoRunPlan: null,
4126 }
4127 );
4128 await ensureAutoRunTimerAlarm(plan.fireAt);
4129}
4130
4131async function ensureManualInteractionAllowed(actionLabel) {
4132 const state = await getState();

Callers 1

background.jsFile · 0.85

Calls 8

getStateFunction · 0.85
clearAutoRunTimerAlarmFunction · 0.85
broadcastAutoRunStatusFunction · 0.85
launchAutoRunTimerPlanFunction · 0.85
ensureAutoRunTimerAlarmFunction · 0.85

Tested by

no test coverage detected