fix: serialize database activity during playout
This commit is contained in:
@@ -173,7 +173,7 @@
|
||||
error: null,
|
||||
lastSignature: ""
|
||||
},
|
||||
database: { sources: [], loading: true, lastSignature: "" },
|
||||
database: { sources: [], loading: true, lastSignature: "", latestSequence: 0 },
|
||||
liveData: {
|
||||
requestId: null,
|
||||
view: null,
|
||||
@@ -1400,6 +1400,12 @@
|
||||
}
|
||||
|
||||
function handleDatabaseStatus(payload) {
|
||||
const sequence = payload?.sequence;
|
||||
if (!playoutSafety.isNewerDatabaseStatusSequence(
|
||||
state.database.latestSequence,
|
||||
sequence)) return;
|
||||
|
||||
state.database.latestSequence = sequence;
|
||||
state.database.sources = normalizedDatabaseSources(payload?.sources);
|
||||
state.database.loading = false;
|
||||
renderDatabaseStatus();
|
||||
|
||||
@@ -69,6 +69,14 @@
|
||||
return !refreshFaulted && error?.isRefreshFault === true;
|
||||
}
|
||||
|
||||
function isNewerDatabaseStatusSequence(latestSequence, incomingSequence) {
|
||||
const latest = Number.isSafeInteger(latestSequence) && latestSequence >= 0
|
||||
? latestSequence
|
||||
: 0;
|
||||
return Number.isSafeInteger(incomingSequence) &&
|
||||
incomingSequence > 0 && incomingSequence > latest;
|
||||
}
|
||||
|
||||
function resolveStoredCatalogIndex(catalog, builderKey, cutCode) {
|
||||
if (!Array.isArray(catalog)) return -1;
|
||||
const exact = catalog.findIndex(item =>
|
||||
@@ -90,6 +98,7 @@
|
||||
canClearCommandError,
|
||||
playlistSnapshotLocked,
|
||||
shouldClearRefreshError,
|
||||
isNewerDatabaseStatusSequence,
|
||||
resolveStoredCatalogIndex
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user