diff --git a/src/main.zig b/src/main.zig index 6b773d2..b0cf07d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -221,9 +221,10 @@ fn printStatus(comptime fmt: []const u8, args: anytype) void { }; } +// Only the atomic store: a log here would rebind the shared stderr writer under +// the interrupted call and can block on the stderr lock. The batch loop reports it. fn handleShutdownSignal(_: posix.SIG) callconv(.c) void { shutdown_requested.store(true, .seq_cst); - std.log.info("Shutdown signal received, initiating graceful shutdown...", .{}); } fn setupSignalHandlers() void { diff --git a/src/processor/processor.zig b/src/processor/processor.zig index 2e6509d..3cdf470 100644 --- a/src/processor/processor.zig +++ b/src/processor/processor.zig @@ -403,6 +403,9 @@ pub const Processor = struct { } } + // The signal handler only sets the flag, so the acknowledgement comes from here. + std.log.info("Shutdown requested, finishing the process...", .{}); + // Graceful stop: cancel and await the worker (runs its final flush/commit) // before reporting the stream stopped. flush_future.cancel(io);