fed-sx-m1: Step 7c — outbox:publish broadcasts to projection processes + 14 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 28s
This commit is contained in:
@@ -91,12 +91,23 @@ publish(Request, Context) ->
|
||||
case pipeline:run_stages(Signed, Stages) of
|
||||
ok ->
|
||||
{ok, NewLog, _Seq} = log:append(LogState, Signed),
|
||||
broadcast(Signed, envelope_field(projections, Context)),
|
||||
Result = [{cid, cid_of(Signed)}, {activity, Signed}],
|
||||
{ok, Result, NewLog};
|
||||
{error, Reason} ->
|
||||
{error, Reason, LogState}
|
||||
end.
|
||||
|
||||
%% broadcast/2 — fire-and-forget cast to each named projection.
|
||||
%% Missing/nil/empty list is a no-op; the publish API does not
|
||||
%% require projections to exist. Activity is the post-sign Signed
|
||||
%% envelope (same value that landed in the log).
|
||||
broadcast(_Activity, nil) -> ok;
|
||||
broadcast(_Activity, []) -> ok;
|
||||
broadcast(Activity, [Name | Rest]) ->
|
||||
projection:async_fold(Name, Activity),
|
||||
broadcast(Activity, Rest).
|
||||
|
||||
envelope_field(K, PL) ->
|
||||
case envelope:get_field(K, PL) of
|
||||
{ok, V} -> V;
|
||||
|
||||
Reference in New Issue
Block a user