mirror of
https://git.robbyzambito.me/zits
synced 2026-02-04 03:34:48 +00:00
Lock subs when reading it
should probably make a copy instead of doing io in the mutex
This commit is contained in:
@@ -202,6 +202,8 @@ fn publishMessage(server: *Server, io: std.Io, alloc: std.mem.Allocator, source_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer msg.deinit(alloc);
|
defer msg.deinit(alloc);
|
||||||
|
try server.subs_lock.lock(io);
|
||||||
|
defer server.subs_lock.unlock(io);
|
||||||
for (server.subscriptions.items) |subscription| {
|
for (server.subscriptions.items) |subscription| {
|
||||||
if (subjectMatches(subscription.subject, msg.subject)) {
|
if (subjectMatches(subscription.subject, msg.subject)) {
|
||||||
const client = server.clients.get(subscription.client_id) orelse {
|
const client = server.clients.get(subscription.client_id) orelse {
|
||||||
|
|||||||
Reference in New Issue
Block a user