Lock subs when reading it

should probably make a copy instead of doing io in the mutex
This commit is contained in:
2026-01-01 18:41:19 +00:00
parent ec1912ba7e
commit ca95c9a06c

View File

@@ -202,6 +202,8 @@ fn publishMessage(server: *Server, io: std.Io, alloc: std.mem.Allocator, source_
}
}
defer msg.deinit(alloc);
try server.subs_lock.lock(io);
defer server.subs_lock.unlock(io);
for (server.subscriptions.items) |subscription| {
if (subjectMatches(subscription.subject, msg.subject)) {
const client = server.clients.get(subscription.client_id) orelse {