diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.cs
index 34d6bc1984..fb5f8d6efa 100644
--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs
+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs
@@ -20,7 +20,10 @@ namespace Emby.Server.Implementations.Activity
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
// Ensure the dir exists
- if (!Directory.Exists(_dataDirPath)) Directory.CreateDirectory(_dataDirPath);
+ if (!Directory.Exists(_dataDirPath))
+ {
+ Directory.CreateDirectory(_dataDirPath);
+ }
optionsBuilder.UseSqlite($"Filename={Path.Combine(_dataDirPath, "activitylog.sqlite.db")}");
}
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 6d0e251ce2..3562074fef 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -709,7 +709,7 @@ namespace Emby.Server.Implementations
}
}
- public void Init()
+ public async Task Init()
{
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
@@ -739,7 +739,7 @@ namespace Emby.Server.Implementations
SetHttpLimit();
- RegisterResources();
+ await RegisterResources();
FindParts();
}
@@ -754,7 +754,7 @@ namespace Emby.Server.Implementations
///
/// Registers resources that classes will depend on
///
- protected void RegisterResources()
+ protected async Task RegisterResources()
{
RegisterSingleInstance(ConfigurationManager);
RegisterSingleInstance(this);
@@ -931,7 +931,7 @@ namespace Emby.Server.Implementations
EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, LoggerFactory, MediaEncoder, ChapterManager, LibraryManager);
RegisterSingleInstance(EncodingManager);
- var activityLogRepo = GetActivityLogRepository();
+ var activityLogRepo = await GetActivityLogRepository();
RegisterSingleInstance(activityLogRepo);
RegisterSingleInstance(new ActivityManager(LoggerFactory, activityLogRepo, UserManager));
@@ -1146,9 +1146,13 @@ namespace Emby.Server.Implementations
return repo;
}
- private IActivityRepository GetActivityLogRepository()
+ private async Task GetActivityLogRepository()
{
- return new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath);
+ var repo = new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath);
+
+ await repo.Database.EnsureCreatedAsync();
+
+ return repo;
}
///
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 0510548b56..bdf8c4e94a 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -99,7 +99,7 @@ namespace Jellyfin.Server
new SystemEvents(),
new NetworkManager(_loggerFactory, environmentInfo)))
{
- appHost.Init();
+ await appHost.Init();
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
@@ -108,7 +108,6 @@ namespace Jellyfin.Server
await appHost.RunStartupTasks();
// TODO: read input for a stop command
-
try
{
// Block main thread until shutdown
@@ -167,7 +166,6 @@ namespace Jellyfin.Server
{
Directory.CreateDirectory(programDataPath);
}
-
string configDir = Environment.GetEnvironmentVariable("JELLYFIN_CONFIG_DIR");
if (string.IsNullOrEmpty(configDir))
{
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index 385127c54b..f32eec6ceb 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -131,7 +131,7 @@ namespace MediaBrowser.Common
///
/// Inits this instance.
///
- void Init();
+ Task Init();
///
/// Creates the instance.