mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
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 <sunil@medhas.org>
This commit is contained in:
parent
d7907e0ef3
commit
c96c97166f
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user