Skip to content

Commit 73ca92a

Browse files
authored
Merge pull request #81 from mhichb/try-catch-findmany
try-catch for FindManyAsync
2 parents a6b3801 + 1c96f9d commit 73ca92a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/modules/retention/Elsa.Retention/Jobs/CleanupJob.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ public async Task ExecuteAsync(CancellationToken cancellationToken = default)
4040

4141
while (true)
4242
{
43-
var page = await workflowInstanceStore.FindManyAsync(filter, pageArgs, cancellationToken);
43+
Page<WorkflowInstance> page;
44+
try
45+
{
46+
page = await workflowInstanceStore.FindManyAsync(filter, pageArgs, cancellationToken);
47+
}
48+
catch (Exception ex)
49+
{
50+
_logger.LogError(ex, "Exception in FindManyAsync during CleanupJob. Policy: {Policy}. Cleanup aborted for this policy.", policy.Name);
51+
break;
52+
}
4453

4554
if (page.Items.Count == 0)
4655
{

0 commit comments

Comments
 (0)