Keep finished jobs' content within queue.content_bytes
A job's content, its JSON, went from the store in the commit that finished it. The store is to keep it for longer, so that a finished job can be previewed or sent again by ID, but a count of jobs cannot bound that: at webserver.body_limit, 1000 finished jobs come to about 4 GB. The new key queue.content_bytes (default 64 MiB, 0 to 1 GiB) bounds the content of finished jobs instead, newest first. Statuses stay as queue.history says; a job past the budget keeps its status without its content. Unfinished jobs always keep their content, and so do uncertain ones while their status is kept, since a reprint needs it. What goes is dropped in the commit that finishes the job pushing it out. With the memory store the content is kept in memory, so the daemon may hold up to the budget more than before; at 1.5 KB per text job, the 1000 jobs of history take about 1.5 MB. Part of stage 1c of docs/plans/job-store.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ef6d21258
commit
8031135508
9 files changed
+220
-32
No files matched your search
@@ -90,11 +90,12 @@ func run(ctx context.Context, cfg *config.Config, build BuildInfo, out io.Writer
|
||||
store := printqueue.NewMemoryStore()
|
||||
defer closeStore(store, logger)
|
||||
queue := printqueue.New(renderer, printerClient, store, logger, printqueue.Options{
|
||||
Size: cfg.Queue.Size,
|
||||
History: cfg.Queue.History,
|
||||
Retries: cfg.Printer.Retries,
|
||||
RetryDelay: cfg.Printer.RetryDelay,
|
||||
OnFailure: reportJobFailure,
|
||||
Size: cfg.Queue.Size,
|
||||
History: cfg.Queue.History,
|
||||
ContentBytes: cfg.Queue.ContentBytes,
|
||||
Retries: cfg.Printer.Retries,
|
||||
RetryDelay: cfg.Printer.RetryDelay,
|
||||
OnFailure: reportJobFailure,
|
||||
})
|
||||
// Restored jobs go ahead of new ones, so nothing may submit before.
|
||||
if err := queue.Restore(ctx); err != nil {
|
||||
|
||||
Reference in new issue
Block a user