Skip to content

Commit

Permalink
Mark stream as offline if manifest file doesn't exist
Browse files Browse the repository at this point in the history
Fixes #226

Signed-off-by: Dave Thaler <[email protected]>
  • Loading branch information
dthaler committed Dec 22, 2024
1 parent 3a65d7a commit e237e6f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions OrcanodeMonitor/Core/Fetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,14 @@ private static void AddHydrophoneStreamStatusEvent(OrcanodeMonitorContext contex
using HttpResponseMessage response = await _httpClient.GetAsync(url);
if (!response.IsSuccessStatusCode)
{
if (updateNode)
{
// Set the manifest updated time to be old, since it would be the timestamp of the
// previous manifest file. The actual value doesn't matter, just that it's older than
// MaxUploadDelay ago so the stream will appear as offline.
node.ManifestUpdatedUtc = DateTime.MinValue;
node.LastCheckedUtc = DateTime.UtcNow;
}
return null;
}

Expand Down Expand Up @@ -967,12 +975,10 @@ public async static Task UpdateManifestTimestampAsync(OrcanodeMonitorContext con
OrcanodeOnlineStatus oldStatus = node.S3StreamStatus;

FrequencyInfo? frequencyInfo = await GetLatestAudioSampleAsync(node, unixTimestampString, true, logger);
if (frequencyInfo == null)
if (frequencyInfo != null)
{
return;
node.AudioStreamStatus = frequencyInfo.Status;
}

node.AudioStreamStatus = frequencyInfo.Status;
node.AudioStandardDeviation = 0.0;

OrcanodeOnlineStatus newStatus = node.S3StreamStatus;
Expand Down

0 comments on commit e237e6f

Please sign in to comment.