feat: add sync relay guard fanout gating and env config
Some checks failed
CI / Test (OTP 27.2 / Elixir 1.18.2) (push) Failing after 0s
CI / Test (OTP 28.4 / Elixir 1.19.4 + E2E) (push) Failing after 0s

This commit is contained in:
2026-03-26 00:36:00 +01:00
parent 8309a89ba7
commit b402d95e47
7 changed files with 91 additions and 6 deletions

View File

@@ -87,7 +87,7 @@ defmodule Parrhesia.API.Events do
end
Dispatcher.dispatch(event)
maybe_publish_multi_node(event)
maybe_publish_multi_node(event, context)
{:ok,
%PublishResult{
@@ -312,9 +312,15 @@ defmodule Parrhesia.API.Events do
end
end
defp maybe_publish_multi_node(event) do
MultiNode.publish(event)
:ok
defp maybe_publish_multi_node(event, %RequestContext{} = context) do
relay_guard? = Parrhesia.Config.get([:sync, :relay_guard], false)
if relay_guard? and context.caller == :sync do
:ok
else
MultiNode.publish(event)
:ok
end
catch
:exit, _reason -> :ok
end