From b014aab9e69aeeafc0f0c7a3ec4c2714fba06ca1 Mon Sep 17 00:00:00 2001 From: Albie Spriddell Date: Sun, 1 Dec 2024 12:21:50 +0000 Subject: [PATCH] add improved error reporting --- DragonFruit.OnionFruit.Web.Worker/Worker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DragonFruit.OnionFruit.Web.Worker/Worker.cs b/DragonFruit.OnionFruit.Web.Worker/Worker.cs index 6ab3894..49ec920 100644 --- a/DragonFruit.OnionFruit.Web.Worker/Worker.cs +++ b/DragonFruit.OnionFruit.Web.Worker/Worker.cs @@ -176,7 +176,7 @@ private List GetDescriptors(IConfiguration config) Task IHostedService.StartAsync(CancellationToken cancellationToken) { _workerTimer?.Dispose(); - _workerTimer = new Timer(s => _ = PerformUpdate(), null, TimeSpan.Zero, TimeSpan.FromHours(12)); + _workerTimer = new Timer(s => _ = PerformUpdate().ContinueWith(e => _logger.LogError(e.Exception, "Refresh failed: {err}", e.Exception?.Message), TaskContinuationOptions.OnlyOnFaulted), null, TimeSpan.Zero, TimeSpan.FromHours(12)); return Task.CompletedTask; }