Skip to content

Commit

Permalink
Make long running tasks get set to foreground.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Mar 22, 2023
1 parent 83b796d commit 426ac58
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/kolibri_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def task_updates(job, orm_job, state=None, **kwargs):
status = job.status(currentLocale)

if status:
print(status.title, status.text)
PythonWorker.mWorker.updateNotificationText(status.title, status.text)

if job.total_progress:
Expand All @@ -61,6 +60,11 @@ def task_updates(job, orm_job, state=None, **kwargs):
if status:
PythonWorker.mWorker.showNotification()

if job.long_running and state == State.RUNNING:
# This is a long running job and it has just started running
# Set to running as foreground
PythonWorker.mWorker.runAsForeground()

if state is not None and orm_job.repeat is None or orm_job.repeat > 0:
if state in {State.COMPLETED, State.CANCELED} or (
state == State.FAILED and not orm_job.retry_interval
Expand Down

0 comments on commit 426ac58

Please sign in to comment.