don't send image to the queue on editing

This commit is contained in:
Alex Bezdieniezhnykh
2025-05-20 12:31:18 +03:00
parent edd803c304
commit 522af51a8d
3 changed files with 8 additions and 6 deletions
@@ -13,7 +13,7 @@ public class AnnotationMessage
[Key(3)] public TimeSpan Time { get; set; } [Key(3)] public TimeSpan Time { get; set; }
[Key(4)] public string ImageExtension { get; set; } = null!; [Key(4)] public string ImageExtension { get; set; } = null!;
[Key(5)] public string Detections { get; set; } = null!; [Key(5)] public string Detections { get; set; } = null!;
[Key(6)] public byte[] Image { get; set; } = null!; [Key(6)] public byte[]? Image { get; set; } = null!;
[Key(7)] public RoleEnum Role { get; set; } [Key(7)] public RoleEnum Role { get; set; }
[Key(8)] public string Email { get; set; } = null!; [Key(8)] public string Email { get; set; } = null!;
[Key(9)] public SourceEnum Source { get; set; } [Key(9)] public SourceEnum Source { get; set; }
+3 -4
View File
@@ -97,7 +97,7 @@ public class AnnotationService : IAnnotationService, INotificationHandler<Annota
msg.Time, msg.Time,
JsonConvert.DeserializeObject<List<Detection>>(msg.Detections) ?? [], JsonConvert.DeserializeObject<List<Detection>>(msg.Detections) ?? [],
msg.Source, msg.Source,
new MemoryStream(msg.Image), msg.Image == null ? null : new MemoryStream(msg.Image),
msg.Role, msg.Role,
msg.Email, msg.Email,
fromQueue: true, fromQueue: true,
@@ -141,9 +141,8 @@ public class AnnotationService : IAnnotationService, INotificationHandler<Annota
await SaveAnnotationInner(DateTime.UtcNow, originalMediaName, time, detections, SourceEnum.Manual, stream, await SaveAnnotationInner(DateTime.UtcNow, originalMediaName, time, detections, SourceEnum.Manual, stream,
_api.CurrentUser.Role, _api.CurrentUser.Email, token: token); _api.CurrentUser.Role, _api.CurrentUser.Email, token: token);
// Manual save from Validators -> Validated -> stream: azaion-annotations-confirm private async Task<Annotation> SaveAnnotationInner(DateTime createdDate, string originalMediaName, TimeSpan time,
// AI, Manual save from Operators -> Created -> stream: azaion-annotations List<Detection> detections, SourceEnum source, Stream? stream,
private async Task<Annotation> SaveAnnotationInner(DateTime createdDate, string originalMediaName, TimeSpan time, List<Detection> detections, SourceEnum source, Stream? stream,
RoleEnum userRole, RoleEnum userRole,
string createdEmail, string createdEmail,
bool fromQueue = false, bool fromQueue = false,
+4 -1
View File
@@ -98,7 +98,10 @@ public class FailsafeAnnotationsProducer
if (annotation == null) if (annotation == null)
continue; continue;
var image = await File.ReadAllBytesAsync(annotation.ImagePath, ct); var image = record.Operation == AnnotationStatus.Created
? await File.ReadAllBytesAsync(annotation.ImagePath, ct)
: null;
var annMessage = new AnnotationMessage var annMessage = new AnnotationMessage
{ {
Name = annotation.Name, Name = annotation.Name,