adjust download manager initialization and some error logging

This commit is contained in:
Stanley Dimant
2023-03-23 16:35:28 +01:00
parent 45ddf7b977
commit f18493d7ee
3 changed files with 9 additions and 4 deletions

View File

@@ -45,7 +45,7 @@ public class ConfigurationMigrator : IHostedService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogWarning("Failed to migrate, skipping", ex); _logger.LogWarning(ex, "Failed to migrate, skipping");
} }
} }
@@ -66,7 +66,7 @@ public class ConfigurationMigrator : IHostedService
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogWarning("Failed to migrate ServerConfig", ex); _logger.LogWarning(ex,"Failed to migrate ServerConfig");
} }
} }
} }

View File

@@ -124,6 +124,8 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
} }
}); });
_downloadManager.Initialize();
Logger.LogDebug("Initializing Player {obj}", this); Logger.LogDebug("Initializing Player {obj}", this);
} }
@@ -184,7 +186,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
} }
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {
Logger.LogWarning("Failed disposing player (not present anymore?)", ex); Logger.LogWarning(ex, "Failed disposing player (not present anymore?)");
break; break;
} }
} }
@@ -459,7 +461,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.LogInformation("[{applicationId}] Cancelled, reason: {msg}", _applicationId, ex.Message); Logger.LogWarning(ex, "[{applicationId}] Cancelled", _applicationId);
} }
}, token); }, token);
}, downloadToken); }, downloadToken);

View File

@@ -28,7 +28,10 @@ public partial class FileDownloadManager : DisposableMediatorSubscriberBase
_downloadStatus = new Dictionary<string, FileDownloadStatus>(StringComparer.Ordinal); _downloadStatus = new Dictionary<string, FileDownloadStatus>(StringComparer.Ordinal);
_orchestrator = orchestrator; _orchestrator = orchestrator;
_fileDbManager = fileCacheManager; _fileDbManager = fileCacheManager;
}
public void Initialize()
{
Mediator.Subscribe<DownloadReadyMessage>(this, (msg) => Mediator.Subscribe<DownloadReadyMessage>(this, (msg) =>
{ {
if (_downloadReady.ContainsKey(msg.RequestId)) if (_downloadReady.ContainsKey(msg.RequestId))