From 426ac58bb4a24ab43cc6023add9e601963583239 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Wed, 22 Mar 2023 09:19:15 -0700 Subject: [PATCH] Make long running tasks get set to foreground. --- src/kolibri_tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kolibri_tasks.py b/src/kolibri_tasks.py index 9c792464..0270586e 100644 --- a/src/kolibri_tasks.py +++ b/src/kolibri_tasks.py @@ -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: @@ -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