correct app close

fix publishing
This commit is contained in:
Alex Bezdieniezhnykh
2025-03-03 19:37:07 +02:00
parent f108cca5f5
commit a493606f64
6 changed files with 43 additions and 21 deletions
+11 -12
View File
@@ -71,6 +71,17 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
MessageHandler = async (stream, consumer, context, message) =>
{
var msg = MessagePackSerializer.Deserialize<AnnotationCreatedMessage>(message.Data.Contents);
await _dbFactory.Run(async db => await db.QueueOffsets
.Where(x => x.QueueName == Constants.MQ_ANNOTATIONS_QUEUE)
.Set(x => x.Offset, context.Offset)
.UpdateAsync(token: cancellationToken));
await ThrottleExt.ThrottleRunAfter(() =>
{
_dbFactory.SaveToDisk();
return Task.CompletedTask;
}, SaveTaskId, TimeSpan.FromSeconds(5), cancellationToken);
if (msg.CreatedRole != RoleEnum.Operator) //Process only operator's messages
return;
@@ -86,18 +97,6 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
msg.CreatedEmail,
generateThumbnail: true,
cancellationToken);
await _dbFactory.Run(async db => await db.QueueOffsets
.Where(x => x.QueueName == Constants.MQ_ANNOTATIONS_QUEUE)
.Set(x => x.Offset, context.Offset)
.UpdateAsync(token: cancellationToken));
await ThrottleExt.ThrottleRunAfter(() =>
{
_dbFactory.SaveToDisk();
return Task.CompletedTask;
}, SaveTaskId, TimeSpan.FromSeconds(3), cancellationToken);
}
});
}
+1
View File
@@ -97,6 +97,7 @@ public class GalleryService(
{
File.Delete(file.FullName);
logger.LogInformation($"No labels found for image {file.FullName}! Image deleted!");
await dbFactory.DeleteAnnotations([fName], cancellationToken);
return;
}