From ebf35df20c5d6caaffb9d4bedb4fa0f4cad54713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCsters?= Date: Tue, 12 Dec 2023 08:24:36 +0100 Subject: [PATCH] Changed renew session lock cancellation token and log exception --- .../AzureServiceBusCommandSessionProcessor`1.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/extensions/azureServiceBus/Wemogy.CQRS.Extensions.AzureServiceBus/Processors/AzureServiceBusCommandSessionProcessor`1.cs b/src/extensions/azureServiceBus/Wemogy.CQRS.Extensions.AzureServiceBus/Processors/AzureServiceBusCommandSessionProcessor`1.cs index 0b18933..574fadf 100644 --- a/src/extensions/azureServiceBus/Wemogy.CQRS.Extensions.AzureServiceBus/Processors/AzureServiceBusCommandSessionProcessor`1.cs +++ b/src/extensions/azureServiceBus/Wemogy.CQRS.Extensions.AzureServiceBus/Processors/AzureServiceBusCommandSessionProcessor`1.cs @@ -105,8 +105,17 @@ public async Task HandleMessageAsync(ProcessSessionMessageEventArgs arg) { await Task.Delay(_renewSessionLockInterval, renewSessionLockCancellationToken); Console.WriteLine($"Renewing session lock for session{arg.SessionId}..."); - await arg.RenewSessionLockAsync(arg.CancellationToken); - Console.WriteLine($"Renewed session lock for session {arg.SessionId}"); + try + { + await arg.RenewSessionLockAsync(renewSessionLockCancellationToken); + Console.WriteLine($"Renewed session lock for session {arg.SessionId}"); + } + catch (Exception e) + { + Console.WriteLine($"Failed to renew session lock for session {arg.SessionId}"); + Console.WriteLine(e); + throw; + } } }, renewSessionLockCancellationTokenSource.Token);