querylog: the writer queue defaults to 1024 entries, and a live stream allocates its ring on subscribe instead of at boot

This commit is contained in:
2026-10-21 22:38:53 +02:00
parent 0cafd770c1
commit d951d03b7d
12 changed files with 234 additions and 129 deletions
+4 -10
View File
@@ -584,16 +584,10 @@ fn serve(r: cli.Runner, args: cli.RunArgs) !u8 {
// Milestone 8 fans every logged query out to the SSE hub as well. The hub
// exists only when the web interface does (ruling 6) — without it the sink
// costs the query path one null check. Its rings are ~900 KiB, so it lives
// on the heap and initializes in place; a by-value init would copy the
// whole of it through this frame.
var hub: ?*sse.Hub = null;
defer if (hub) |hub_ptr| gpa.destroy(hub_ptr);
if (cfg.web.enabled) {
const created = try gpa.create(sse.Hub);
created.init();
hub = created;
}
// costs the query path one null check.
var hub_storage: sse.Hub = .init(gpa);
defer hub_storage.deinit();
const hub: ?*sse.Hub = if (cfg.web.enabled) &hub_storage else null;
// -----------------------------------------------------------------------
// disk, retention and the remaining connections (ruling 21)