Repository navigation
Remove Valkey and run background jobs in process - #593
Conversation
pmeier
left a comment
There was a problem hiding this comment.
Thanks Anuj. Added some comments.
|
|
||
| // Publish lifecycle handles atomically with starting the worker. If the | ||
| // window closed during initialization, do not start background work. | ||
| a.lifecycleMu.Lock() |
There was a problem hiding this comment.
Please explain why we need to add all this functionality here although this PR is meant to remove stuff.
There was a problem hiding this comment.
This adds explicit lifecycle management for the in-process worker: on desktop shutdown, we cancel jobs, reject new submissions, and wait for cleanup and final status/log writes before Wails exits. Since initialization runs in a goroutine, the mutex also prevents shutdown from missing a worker that is still starting, or initialization from starting one after shutdown.
To clarify the scope: the desktop already used an in-memory queue before this PR, so this fixes an existing shutdown gap rather than being strictly required by removing Valkey. I included it to give the in-process worker a complete shutdown lifecycle.
There was a problem hiding this comment.
Please factor this out into a separate PR. I agree this is needed, but out of scope for the valkey removal.
There was a problem hiding this comment.
I will create a new PR once this is merged with these changes thanks!.
|
@MUFFANUJ GH didn't do what I wanted. The requested changes are #593 (comment) |
|
We could close this? |
|
@MUFFANUJ What do you mean by "close" here? The PR is merged already. |
thats strange i commented on the issue, since that was open |
Reference Issues or PRs
Closes #586
What does this implement/fix?
Put a
xin the boxes that applyTesting
Documentation
Updated server setup documentation with in-memory job processing, restart recovery, shutdown behavior, and migration instructions. Updated architecture documentation and diagrams to remove Valkey and external workers.
Access-centered content checklist
Text styling
H1or#in markdown).Non-text content
Any other comments?
Removes the Valkey queue, distributed log transport, standalone worker modes, related configuration and dependencies, and external worker services from Compose. Background jobs now run serially using the in-memory queue and log broker. The queue retains only pending work; job history and logs remain in the database.
Adds startup recovery to mark interrupted jobs and unfinished workspace transitions as failed so users can retry. Server and desktop shutdown now cancel the worker and wait up to 40 seconds for cleanup and final writes. Worker exit closes all log streams, including pending jobs and late subscriptions. Compose selects the correct server build target and allows a 45-second shutdown grace period. Includes migration documentation and regression tests.
Question: Recovery assumes one running instance per database. Starting another instance against the same database can mark live jobs as failed, even if its HTTP listener subsequently fails to bind. How likely is this scenario, and should exclusive database ownership be enforced here or handled separately?
List of breaking changes (for future referene)
queue.typeandqueue.valkey_addrfrom configuration files, andNEBI_QUEUE_TYPE/NEBI_QUEUE_VALKEY_ADDRfrom deployment environments. Nebi now always uses the in-memory queue.--mode/-m(server,worker, orboth) fromnebi-serverandnebi-webcommands. Both binaries now run the API and background worker together.Concurrency is configurable through
worker.max_parallel_jobsorNEBI_WORKER_MAX_PARALLEL_JOBS, defaulting to half the available CPU cores, with a minimum of one.The team server still executes background jobs. Moving execution exclusively to clients was not part of this PR. Startup recovery and lifecycle improvements were also excluded from this PR.