Skip to content

Commit

Permalink
fix for review cancelation
Browse files Browse the repository at this point in the history
Signed-off-by: Neil South <[email protected]>
  • Loading branch information
neildsouth committed Feb 26, 2024
1 parent 97bfa29 commit 1f123f0
Showing 1 changed file with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/

using Ardalis.GuardClauses;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
Expand Down Expand Up @@ -321,6 +320,26 @@ public async ValueTask DisposeAsync()
GC.SuppressFinalize(this);

Check warning on line 320 in src/TaskManager/Plug-ins/AideClinicalReview/AideClinicalReviewPlugin.cs

View workflow job for this annotation

GitHub Actions / sonarscanner

Do not call 'GC.SuppressFinalize'. (https://rules.sonarsource.com/csharp/RSPEC-3971)
}

public override Task HandleTimeout(string identity) => Task.CompletedTask; // not implemented
public override Task HandleTimeout(string identity)
{
var message = GenerateCancelationMessage(identity);

var queue = _queueName ?? _options.Value.Messaging.Topics.AideClinicalReviewCancelation;
_logger.SendClinicalReviewRequestMessage(queue, _workflowName ?? string.Empty);
return _messageBrokerPublisherService.Publish(queue, message.ToMessage());
}

private JsonMessage<TaskCancellationEvent> GenerateCancelationMessage(string identity)
{
return new JsonMessage<TaskCancellationEvent>(new TaskCancellationEvent
{
ExecutionId = identity,
WorkflowInstanceId = Event.WorkflowInstanceId,
TaskId = Event.TaskId,
Reason = FailureReason.TimedOut,
Identity = identity,
Message = $"{FailureReason.TimedOut} {DateTime.UtcNow}"
}, TaskManagerApplicationId, Event.CorrelationId);
}
}
}

0 comments on commit 1f123f0

Please sign in to comment.