Commit 3279eb5
committed
fix: defer report scheduler checkpoint until enqueue succeeds
Move the REPORT_SCHEDULER_LAST_CHECK_CACHE_KEY checkpoint update from
before the enqueue loop to after each hour bucket is fully processed.
Previously the checkpoint was advanced to 'now' before any messages
were published. If the process crashed or the message queue was
unavailable, the pending hour buckets were permanently skipped because
the next run would start from the already-advanced checkpoint.
Changes:
- Advance checkpoint incrementally per hour bucket, only after all
reports in that bucket have been successfully enqueued.
- Stop advancing checkpoint on first enqueue failure so the failed
hour bucket (and any remaining ones) are retried on the next tick.
- Propagate cache.insert errors via '?' instead of silently ignoring
them with 'let _ ='.
- When no hour boundaries need processing, still advance checkpoint
to avoid re-scanning the same sub-hour window.
Fixes #15861 parent 9bafeb5 commit 3279eb5
1 file changed
+21
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 99 | | |
104 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| 134 | + | |
132 | 135 | | |
133 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
134 | 151 | | |
135 | 152 | | |
136 | 153 | | |
| |||
0 commit comments