Skip to content
Snippets Groups Projects
Unverified Commit 873971a8 authored by Mathieu Velten's avatar Mathieu Velten Committed by GitHub
Browse files

Task scheduler: mark task as active if we are scheduling ASAP (#16165)

parent da162cbe
No related branches found
No related tags found
No related merge requests found
Task scheduler: mark task as active if we are scheduling as soon as possible.
...@@ -92,7 +92,7 @@ class TaskSchedulerWorkerStore(SQLBaseStore): ...@@ -92,7 +92,7 @@ class TaskSchedulerWorkerStore(SQLBaseStore):
if clauses: if clauses:
sql = sql + " WHERE " + " AND ".join(clauses) sql = sql + " WHERE " + " AND ".join(clauses)
sql = sql + "ORDER BY timestamp" sql = sql + " ORDER BY timestamp"
txn.execute(sql, args) txn.execute(sql, args)
return self.db_pool.cursor_to_dict(txn) return self.db_pool.cursor_to_dict(txn)
......
...@@ -154,13 +154,15 @@ class TaskScheduler: ...@@ -154,13 +154,15 @@ class TaskScheduler:
f"No function associated with action {action} of the scheduled task" f"No function associated with action {action} of the scheduled task"
) )
status = TaskStatus.SCHEDULED
if timestamp is None or timestamp < self._clock.time_msec(): if timestamp is None or timestamp < self._clock.time_msec():
timestamp = self._clock.time_msec() timestamp = self._clock.time_msec()
status = TaskStatus.ACTIVE
task = ScheduledTask( task = ScheduledTask(
random_string(16), random_string(16),
action, action,
TaskStatus.SCHEDULED, status,
timestamp, timestamp,
resource_id, resource_id,
params, params,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment