From 761a31b71c590513946075da56a21136f8ac06a2 Mon Sep 17 00:00:00 2001 From: moreal Date: Wed, 23 Oct 2024 01:58:47 +0900 Subject: [PATCH] Continue even if it throws exception --- Mimir.Worker/Handler/BaseDiffHandler.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Mimir.Worker/Handler/BaseDiffHandler.cs b/Mimir.Worker/Handler/BaseDiffHandler.cs index 8d0fb063..778c0c47 100644 --- a/Mimir.Worker/Handler/BaseDiffHandler.cs +++ b/Mimir.Worker/Handler/BaseDiffHandler.cs @@ -32,8 +32,15 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) while (!stoppingToken.IsCancellationRequested) { - var diffContext = await ProduceByAccount(stoppingToken); - await ConsumeAsync(diffContext, stoppingToken); + try + { + var diffContext = await ProduceByAccount(stoppingToken); + await ConsumeAsync(diffContext, stoppingToken); + } + catch (Exception e) + { + Logger.Error(e, "Unexpected error occurred."); + } } }