-
-
Notifications
You must be signed in to change notification settings - Fork 96
Description
Description
The main use case of the "background task" feature seems to be for synchronization; whether using the builtin task sync (as shown in the docs), or committing to a private repository, etc. The goal is for tasks to sync reliably without the user needing to manually invoke the command.
However, consider a situation where one opens the TUI, makes a change to the database, then immediately exits. In this case, the program won't have been open long enough to for the periodic run to happen, meaning the change will remain un-synced until the next time the program is opened.
Solution
I think of task sync I bit like saving the document in a text editor. Thus, I feel it would be intuitive to provide a configuration option that makes the background task run on exit. For example, we could expose an option like this:
uda.taskwarrior-tui.background_process_on_exit=true
# if the period is set to 0, the background process
# ONLY runs on exit
uda.taskwarrior-tui.background_process_period=0With such an option enabled, when the user closes taskwarrior-tui with the quit action, we
can run the background process command before exiting. We'd likely want to fork & background that process so it doesn't cause the TUI to hang before closing.