neiam
/oh-my-ex-oh-ircd
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
local_broadcast vs broadcast
bbe48e1 · gmorell · 2026-06-07 01:47
Files changed
modified
lib/oh_my_ex_oh_ircd/irc/message_log.ex
+6
−1
@@ -137,7 +137,12 @@ defmodule OhMyExOhIrcd.IRC.MessageLog do
| 137 | 137 | |> Enum.map(&Map.fetch!(map, &1)) |
| 138 | 138 | |> Enum.each(fn entry -> |
| 139 | 139 | HLC.observe(entry.ts) |
| 140 | − Phoenix.PubSub.broadcast(@pubsub, channel_topic(entry.target), {:irc_privmsg, entry}) | |
| 140 | + | |
| 141 | + # local_broadcast, NOT broadcast: every node runs this same drain | |
| 142 | + # against its own (fully replicated) CRDT, so each node must only | |
| 143 | + # fan out to its *locally* connected subscribers. A cluster-wide | |
| 144 | + # broadcast here delivers every message once per node. | |
| 145 | + Phoenix.PubSub.local_broadcast(@pubsub, channel_topic(entry.target), {:irc_privmsg, entry}) | |
| 141 | 146 | end) |
| 142 | 147 | |
| 143 | 148 | %{state | seen: all_keys} |
Parents: 38c4d7b