Skip to content

Commit

Permalink
Add an experiment for the stream wait change (#2312)
Browse files Browse the repository at this point in the history
To be a bit more cautious I think we should have an experiment for this new stream wait logic so that we can easily switch it on and off in prod, as well as being able to test it out with our own accounts first
  • Loading branch information
mjh1 authored Sep 18, 2024
1 parent fb5983e commit 896102c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/api/src/controllers/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ import {
TooManyRequestsError,
UnprocessableEntityError,
} from "../store/errors";
import { ensureExperimentSubject } from "../store/experiment-table";
import {
ensureExperimentSubject,
isExperimentSubject,
} from "../store/experiment-table";
import messages from "../store/messages";
import Queue from "../store/queue";
import { DBSession } from "../store/session-table";
Expand Down Expand Up @@ -1257,8 +1260,12 @@ app.put(
? pathJoin(streamPullUrl + stream.playbackId, `index.m3u8`)
: getHLSPlaybackUrl(ingest, stream);
if (!stream.isActive || streamExisted) {
triggerCatalystPullStart(stream, playbackUrl);
await waitCatalystStreamReady(stream, playbackUrl);
if (await isExperimentSubject("stream-metadata-wait", req.user.id)) {
triggerCatalystPullStart(stream, playbackUrl);
await waitCatalystStreamReady(stream, playbackUrl);
} else {
await triggerCatalystPullStart(stream, playbackUrl);
}
}

res.status(streamExisted ? 200 : 201);
Expand Down

0 comments on commit 896102c

Please sign in to comment.