Refactor Process State handling #548
Labels
s: Daemon
This issue touches pueue daemon
s: Pueue-lib
This issue touches the pueue-lib library
t: Enhancement
Something that exists, but could be made better
Problem
Right now, the TaskHandler that supervises the handles for all subprocesses runs in one thread while the API handlers for the client run in their own threads. The process handles are currently bound to the TaskHandler's memory and not directly visible to the message handlers.
Due to the limitation of this design, any client commands that directly affect a process, such as
pueue add --immediate
, need to be forwarded viampsc
channel to the TaskHandler, as the message handlers have no access to the process handles.This results in a short delay for such actions, which becomes a problem when scripting Pueue and also when writing tests.
Solutions
There're two approaches to solve this problem:
Mutex<State>
that already exists. Right now, theState
is always serialized to disk and serves as the point of restoration on restart. There were some problems with this approach, but I cannot remember them right now.In general, I would really like to only have a single mutex to prevent deadlocks, so if it's viable, I would prefer the first solution.
Tasks:
TaskHandler
to theState
TaskHandler
into free functionsAs a general rule, the state may only get locked in:
The text was updated successfully, but these errors were encountered: