Repository navigation
Commit 3129f39
Track scheduled recurring tasks by record id
A task that's deleted and created again with the same key gets a new id,
so keying the in-memory schedule by id lets the existing steps that
schedule new tasks and unschedule deleted ones handle it, without a
second map from keys to ids or a separate active flag. A run only
schedules the next one if its task is still in the schedule, which also
covers a replaced task and a stopped scheduler. The database query for
dynamic tasks now runs before taking the lock, so it doesn't hold up a
task that's due.
Polling now only unschedules dynamic tasks. A static task whose row is
deleted keeps running until the scheduler restarts, when it reads the
configuration again.
Also freeze time in the test for tasks updated in place, so a run at the
top of the hour can't land between its two lookups.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 03f759d commit 3129f39
2 files changed
Lines changed: 41 additions & 62 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
| |||
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | | - | |
| 33 | + | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 37 | | |
45 | 38 | | |
46 | | - | |
47 | 39 | | |
48 | 40 | | |
49 | | - | |
50 | 41 | | |
51 | 42 | | |
52 | 43 | | |
| |||
56 | 47 | | |
57 | 48 | | |
58 | 49 | | |
| 50 | + | |
| 51 | + | |
59 | 52 | | |
60 | | - | |
61 | 53 | | |
62 | | - | |
63 | 54 | | |
64 | 55 | | |
65 | 56 | | |
66 | 57 | | |
67 | 58 | | |
68 | 59 | | |
69 | | - | |
| 60 | + | |
70 | 61 | | |
71 | 62 | | |
72 | 63 | | |
| |||
80 | 71 | | |
81 | 72 | | |
82 | 73 | | |
| 74 | + | |
| 75 | + | |
83 | 76 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 77 | + | |
97 | 78 | | |
98 | 79 | | |
99 | 80 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 81 | + | |
| 82 | + | |
116 | 83 | | |
117 | 84 | | |
118 | 85 | | |
119 | | - | |
120 | | - | |
| 86 | + | |
| 87 | + | |
121 | 88 | | |
122 | 89 | | |
123 | 90 | | |
| |||
141 | 108 | | |
142 | 109 | | |
143 | 110 | | |
144 | | - | |
| 111 | + | |
145 | 112 | | |
146 | 113 | | |
147 | 114 | | |
| |||
156 | 123 | | |
157 | 124 | | |
158 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
159 | 133 | | |
160 | 134 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | 198 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
208 | 212 | | |
209 | | - | |
210 | | - | |
| 213 | + | |
| 214 | + | |
211 | 215 | | |
212 | | - | |
| 216 | + | |
| 217 | + | |
213 | 218 | | |
214 | 219 | | |
215 | 220 | | |
| |||
0 commit comments