Skip to content

Commit

Permalink
Merge pull request #967 from Project-MONAI/AI-288
Browse files Browse the repository at this point in the history
fix for review cancelation
  • Loading branch information
neildsouth authored Feb 27, 2024
2 parents fd98de2 + ade5985 commit a818376
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);
}

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 a818376

Please sign in to comment.