Commit 5b97dadd authored by Mark Harding's avatar Mark Harding

(fix): only fire notifications when all transcodes have reached a state

1 merge request!414WIP: New transcoder
Pipeline #102221704 running with stages
......@@ -40,6 +40,7 @@ class TranscodeStates
'guid' => $video->getGuid(),
]);
$total = 0;
$created = 0;
$failures = 0;
$completed = 0;
......@@ -48,6 +49,7 @@ class TranscodeStates
if ($transcode instanceof TranscodeProfiles\Thumbnails) {
continue; // We skip thumbnails as these are likely to succeed
}
++$total;
switch ($transcode->getStatus()) {
case TranscodeStates::TRANSCODING:
if ($transcode->getLastEventTimestampMs() >= (time() - Manager::TRANSCODER_TIMEOUT_SECS) * 1000) {
......@@ -75,6 +77,10 @@ class TranscodeStates
return TranscodeStates::CREATED;
}
if ($total < ($completed + $failures)) {
return TranscodeStates::CREATED;
}
// If we have more completions then failures the declare completed
if ($failures < $completed) {
return TranscodeStates::COMPLETED;
......
Please register or to comment