adding explicit handling for null item in watcher, skipping user watchers without spotify link, fixed weird systemd issue with async run
This commit is contained in:
parent
a0090470e8
commit
46b7cb37bd
@ -83,7 +83,9 @@ namespace Selector.CLI
|
||||
|
||||
var indices = new HashSet<string>();
|
||||
|
||||
foreach (var dbWatcher in db.Watcher.Include(w => w.User))
|
||||
foreach (var dbWatcher in db.Watcher
|
||||
.Include(w => w.User)
|
||||
.Where(w => !string.IsNullOrWhiteSpace(w.User.SpotifyRefreshToken)))
|
||||
{
|
||||
Logger.LogInformation($"Creating new [{dbWatcher.Type}] watcher");
|
||||
|
||||
|
@ -26,8 +26,7 @@ namespace Selector.CLI
|
||||
}
|
||||
};
|
||||
|
||||
var host = CreateHostBuilder(args, ConfigureDefault, ConfigureDefaultNlog);
|
||||
await host.RunConsoleAsync();
|
||||
CreateHostBuilder(args, ConfigureDefault, ConfigureDefaultNlog).Build().Run();
|
||||
}
|
||||
|
||||
public static RootOptions ConfigureOptions(HostBuilderContext context, IServiceCollection services)
|
||||
|
@ -130,6 +130,14 @@ namespace Selector
|
||||
OnItemChange(GetEvent());
|
||||
}
|
||||
}
|
||||
else if (Previous.Item is null)
|
||||
{
|
||||
Logger.LogWarning($"Previous item was null [{Previous.DisplayString()}]");
|
||||
}
|
||||
else if (Live.Item is null)
|
||||
{
|
||||
Logger.LogWarning($"Live item was null [{Live.DisplayString()}]");
|
||||
}
|
||||
else {
|
||||
Logger.LogError($"Unknown combination of previous and current playing contexts, [{Previous.DisplayString()}] [{Live.DisplayString()}]");
|
||||
throw new NotSupportedException("Unknown item combination");
|
||||
|
Loading…
Reference in New Issue
Block a user