Skip to content

Commit 2728b05

Browse files
committed
fix(webapp): skip cron back-calc for inactive schedules in list
ScheduleListPresenter was deriving "Last run" via cron's previous slot even for deactivated schedules, causing the dashboard to show "1 minute ago" for a schedule that was actually deactivated months ago. Gate the cron back-calc on `schedule.active`. Inactive schedules now show "–" in the Last run cell, matching the semantic that they aren't firing. Per Devin review on PR #3476.
1 parent be6e27f commit 2728b05

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

apps/webapp/app/presenters/v3/ScheduleListPresenter.server.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,21 +246,25 @@ export class ScheduleListPresenter extends BasePresenter {
246246
});
247247

248248
const schedules: ScheduleListItem[] = rawSchedules.map((schedule) => {
249-
// Approximate "last run" from the cron's previous slot. If that slot
250-
// predates the schedule itself, the schedule hasn't fired yet — show
251-
// undefined rather than a misleading timestamp. UI is best-effort;
252-
// accurate run history is on the schedule's runs page. cron-parser
249+
// Approximate "last run" from the cron's previous slot. Skip inactive
250+
// schedules — the cron's previous slot reflects what *would* have
251+
// fired, but a deactivated schedule didn't actually fire there. Skip
252+
// schedules whose cron's previous slot predates their creation — the
253+
// schedule hasn't existed long enough to have fired. cron-parser
253254
// throws on malformed expressions, so degrade to undefined per-row
254-
// rather than failing the whole list.
255+
// rather than failing the whole list. UI is best-effort; the runs
256+
// page is the source of truth.
255257
let lastRun: Date | undefined;
256-
try {
257-
const cronPrev = previousScheduledTimestamp(
258-
schedule.generatorExpression,
259-
schedule.timezone
260-
);
261-
lastRun = cronPrev.getTime() > schedule.createdAt.getTime() ? cronPrev : undefined;
262-
} catch {
263-
lastRun = undefined;
258+
if (schedule.active) {
259+
try {
260+
const cronPrev = previousScheduledTimestamp(
261+
schedule.generatorExpression,
262+
schedule.timezone
263+
);
264+
lastRun = cronPrev.getTime() > schedule.createdAt.getTime() ? cronPrev : undefined;
265+
} catch {
266+
lastRun = undefined;
267+
}
264268
}
265269

266270
return {

0 commit comments

Comments
 (0)