Tests:
- In development mode, diagnostics task runs after about 180 seconds (with
jitter).
- In production mode, diagnostics task does not run after 180 seconds.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
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>
- When many tasks are scheduled at once, they will try to write to the database
at the same time. This happens prominently in develop mode when multiple
notifications are attempted to be shown.
- Also other resource contention may happen.
- Avoid this by adding or subtracting 5% to the provided task scheduling
interval time.
Tests:
- Print the interval times in the schedule() method and verify that the final
interval values are randomized and vary by only 5% from the provided interval.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Tests:
- Print the interval time in schedule() method and verify that the times are as
expected in develop mode and production mode.
- Notification shows up for RAM usage if the check hardcoded to True.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Chmod -x dbus.py. It appears that the file was accidentally set to permissions
0o755 instead of 0o644.
glib module will contain:
- Code to deal with glib main loop.
- Use glib as a way to schedule timely events instead of creating long running
threads.
- Other mechanisms to help with asynchronous I/O until we start using asyncio.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>