reject long timeouts as we're shutting down

This commit is contained in:
Karl Seguin
2025-06-23 17:27:22 +08:00
parent 3c07c0818d
commit 256540934b

View File

@@ -193,6 +193,11 @@ pub const Loop = struct {
}
pub fn timeout(self: *Self, nanoseconds: u63, callback_node: ?*CallbackNode) !usize {
if (self.stopping and nanoseconds > std.time.ns_per_ms * 500) {
// we're trying to shutdown, we probably don't want to wait for a new
// long timeout
return 0;
}
const completion = try self.alloc.create(Completion);
errdefer self.alloc.destroy(completion);
completion.* = undefined;