You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use relative delay (seconds) instead of absolute scheduled_time
Change scheduling parameter from absolute datetime to relative seconds:
- Rename scheduled_time to delay (float, seconds from now)
- Uses database server time (NOW() + INTERVAL) to avoid clock sync issues
- Update all examples to use delay parameter
Copy file name to clipboardExpand all lines: docs/src/design/autopopulate-2.0-spec.md
+14-18Lines changed: 14 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,7 +149,7 @@ class JobsTable(Table):
149
149
defrefresh(
150
150
self,
151
151
*restrictions,
152
-
scheduled_time: datetime=None,
152
+
delay: float=0,
153
153
priority: int=5,
154
154
stale_timeout: float=None
155
155
) -> dict:
@@ -163,9 +163,9 @@ class JobsTable(Table):
163
163
164
164
Args:
165
165
restrictions: Conditions to filter key_source
166
-
scheduled_time: When new jobs should become available for processing.
167
-
Default: now (jobs are immediately available).
168
-
Use future times to schedule jobs for later processing.
166
+
delay: Seconds from now until jobs become available for processing.
167
+
Default: 0 (jobs are immediately available).
168
+
Uses database server time to avoid client clock synchronization issues.
169
169
priority: Priority for new jobs (lower = more urgent). Default: 5
170
170
stale_timeout: Seconds after which pending jobs are checked for staleness.
171
171
Jobs older than this are removed if their key is no longer
@@ -301,11 +301,9 @@ MyTable.jobs.progress() # Returns detailed status breakdown
301
301
302
302
### Priority and Scheduling
303
303
304
-
Priority and scheduling are handled via `refresh()` parameters. Lower priority values are more urgent (0 = highest priority).
304
+
Priority and scheduling are handled via `refresh()` parameters. Lower priority values are more urgent (0 = highest priority). Scheduling uses relative time (seconds from now) based on database server time.
305
305
306
306
```python
307
-
from datetime import datetime, timedelta
308
-
309
307
# Add urgent jobs (priority=0 is most urgent)
310
308
MyTable.jobs.refresh(priority=0)
311
309
@@ -316,12 +314,13 @@ MyTable.jobs.refresh()
316
314
MyTable.jobs.refresh(priority=10)
317
315
318
316
# Schedule jobs for future processing (2 hours from now)
0 commit comments