Refactor retry attempt retrieval logic in context reader.
Improved handling of retry attempt records by leveraging a conversion helper method. This ensures type safety and simplifies the code for better readability and maintainability. Also includes minor formatting adjustments.
This commit is contained in:
parent
7b75f0c89f
commit
16fb757ef3
|
|
@ -1,4 +1,5 @@
|
|||
using Elsa.Common.Models;
|
||||
using Elsa.Expressions.Helpers;
|
||||
using Elsa.Extensions;
|
||||
using Elsa.Resilience.Entities;
|
||||
using Elsa.Workflows.Runtime;
|
||||
|
|
@ -14,9 +15,11 @@ public class ActivityExecutionContextRetryAttemptReader(IActivityExecutionStore
|
|||
Id = activityInstanceId
|
||||
}, cancellationToken);
|
||||
|
||||
if (record?.Properties == null || !record.Properties.TryGetValue("RetryAttempts", out var value) || value is not ICollection<RetryAttemptRecord> retryAttempts)
|
||||
if (record?.Properties == null || !record.Properties.TryGetValue("RetryAttempts", out var value))
|
||||
return Page.Empty<RetryAttemptRecord>();
|
||||
|
||||
var retryAttempts = value.ConvertTo<ICollection<RetryAttemptRecord>>() ?? [];
|
||||
|
||||
return retryAttempts.Paginate(pageArgs);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue