Skip to content

fix: send each SGAI ad-break cycle as one group - #8

Open
pzanella wants to merge 1 commit into
mainfrom
fix/sgai-event-delivery
Open

pzanella wants to merge 1 commit into
mainfrom
fix/sgai-event-delivery

Conversation

@pzanella

Copy link
Copy Markdown
Owner

What

The SGAI events track now uses one MoQ group per ad-break cycle. Each event is one frame in that group.

Why

Before, each event was its own group. @moq/net's track-level readFrame() / readJson() drops an older group as soon as a newer one exists, even if the older group's frame has not arrived yet. So two events sent close together could lose one. The 50 ms gap between writes only made this less likely. This also blocked the update to moq-relay 0.14.18+.

Changes

  • sgai/ad-decisioning-publisher.mjs: one group per cycle, the 50 ms queue is removed. A subscriber that joins mid-cycle first gets the events of that cycle that were already sent.
  • sgai/debug-subscriber.mjs: reads each group to its end (recvGroup(), then readJson() on the group).
  • New sgai/event-delivery.ci-check.mjs: compares the publisher and subscriber logs and fails if an event is lost. Used in smoke-test-sgai and smoke-test-podman-sgai.
  • README (section 7), CHANGELOG, CONTRIBUTING.

Tests

Local, with moq-relay 0.14.5 and 0.17.8: no lost events, also with five events at the same moment and with the CPU under load. A subscriber that joins after the first blackout event: the old code lost it in 5 runs out of 5, the new code in 0.

Each event was its own MoQ group. @moq/net's track-level readFrame()
drops an older group as soon as a newer one exists, even if the older
group's frame has not arrived yet, so two events sent close together
could lose one. The 50 ms gap between writes only made this less likely.

Now the events track has one group per ad-break cycle and each event is
one frame in it, so a cycle's events arrive complete and in order. The
50 ms queue is removed. debug-subscriber.mjs reads each group to its
end. A subscriber that joins mid-cycle first gets the events of that
cycle that were already sent.

New sgai/event-delivery.ci-check.mjs compares the publisher and
subscriber logs in both SGAI CI jobs and fails if an event is lost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant