| | | 1 | | using Elsa.Mediator.Contracts; |
| | | 2 | | using Elsa.Workflows.Management.Notifications; |
| | | 3 | | using Elsa.Workflows.Runtime.Filters; |
| | | 4 | | using JetBrains.Annotations; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Workflows.Runtime.Handlers; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Deletes workflow execution log records in response to the <see cref="WorkflowInstancesDeleting"/> notification. |
| | | 10 | | /// </summary> |
| | | 11 | | [PublicAPI] |
| | | 12 | | internal class DeleteWorkflowExecutionLogRecords : INotificationHandler<WorkflowInstancesDeleting> |
| | | 13 | | { |
| | | 14 | | private readonly IWorkflowExecutionLogStore _store; |
| | | 15 | | |
| | | 16 | | /// <summary> |
| | | 17 | | /// Initializes a new instance of the <see cref="DeleteWorkflowExecutionLogRecords"/> class. |
| | | 18 | | /// </summary> |
| | 467 | 19 | | public DeleteWorkflowExecutionLogRecords(IWorkflowExecutionLogStore store) |
| | | 20 | | { |
| | 467 | 21 | | _store = store; |
| | 467 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <inheritdoc /> |
| | | 25 | | public async Task HandleAsync(WorkflowInstancesDeleting notification, CancellationToken cancellationToken) |
| | | 26 | | { |
| | 13 | 27 | | await DeleteManyAsync(new WorkflowExecutionLogRecordFilter { WorkflowInstanceIds = notification.Ids }, cancellat |
| | 13 | 28 | | } |
| | | 29 | | |
| | | 30 | | private async Task DeleteManyAsync(WorkflowExecutionLogRecordFilter filter, CancellationToken cancellationToken = de |
| | | 31 | | { |
| | 13 | 32 | | await _store.DeleteManyAsync(filter, cancellationToken); |
| | 13 | 33 | | } |
| | | 34 | | } |