From c96c97166f0179c600ae2198688d2f394a829bb4 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 23 Jan 2024 11:40:57 -0800 Subject: [PATCH] glib: Change API for repeating an in-thread scheduled task Previously, in glib.schedule(), when in_thread is set to True, it is expected that the task method return whether it wants to be repeated (True) or not (False). However, this was not documented and different from the behavior of the separate-thread task (passed as argument repeat=). To simply and improve consistency, use the repeat= argument instead of return value from the method. This fixes issue with daily diagnostics not running for the second time. Signed-off-by: Sunil Mohan Adapa --- plinth/glib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plinth/glib.py b/plinth/glib.py index 77721f713..5ef5fbec8 100644 --- a/plinth/glib.py +++ b/plinth/glib.py @@ -65,7 +65,8 @@ def schedule(interval, method, data=None, in_thread=True, repeat=True, def _run_bare_or_thread(_user_data): """Run the target method in thread or directly (if async).""" if not in_thread: - return _runner() + _runner() + return repeat thread = threading.Thread(target=_runner) thread.start()