Commit 6765f63
committed
fix(schedule-engine): seed lastScheduleTime on recovery via cron-prev
Recovery (Redis job missing for an instance) was re-registering with
no lastScheduleTime, so the post-recovery first fire fell through the
fallback chain to instance.lastScheduledTimestamp — which is frozen at
the value last written before this PR stopped writing the column. For
schedules that fired heavily after deploy then suffered a Redis loss,
that meant payload.lastTimestamp would report a stale pre-deploy
timestamp on the first fire post-recovery.
Compute lastScheduleTime as the cron expression's previous slot (pure
cron math, no DB read — recovery fan-outs must not add load to hot
tables). Guarded against the cron-prev predating the instance's
createdAt and against cron-parser throwing on malformed expressions.
For continuously-running schedules this equals the actual last fire
time; for long-paused or recently-edited schedules it's the same
approximation the dashboard "Last run" cell accepts.
Per Devin and CodeRabbit review on PR #3476.1 parent 695eab1 commit 6765f63
2 files changed
Lines changed: 57 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
699 | 703 | | |
700 | 704 | | |
701 | 705 | | |
| 706 | + | |
702 | 707 | | |
703 | 708 | | |
704 | 709 | | |
705 | 710 | | |
| 711 | + | |
706 | 712 | | |
707 | 713 | | |
708 | 714 | | |
| |||
777 | 783 | | |
778 | 784 | | |
779 | 785 | | |
| 786 | + | |
780 | 787 | | |
781 | | - | |
| 788 | + | |
782 | 789 | | |
783 | 790 | | |
784 | 791 | | |
| |||
793 | 800 | | |
794 | 801 | | |
795 | 802 | | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
796 | 826 | | |
797 | 827 | | |
798 | 828 | | |
| 829 | + | |
799 | 830 | | |
800 | 831 | | |
801 | | - | |
802 | | - | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
803 | 836 | | |
804 | 837 | | |
805 | 838 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
32 | 52 | | |
33 | 53 | | |
34 | 54 | | |
| |||
0 commit comments