fix queue, fix ai email and role set

This commit is contained in:
Alex Bezdieniezhnykh
2025-03-06 19:06:09 +02:00
parent dc44340f67
commit 4e6624ee58
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -82,7 +82,7 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
return Task.CompletedTask;
}, SaveTaskId, TimeSpan.FromSeconds(5), cancellationToken);
if (msg.CreatedRole != RoleEnum.Operator) //Process only operator's messages
if (msg.CreatedEmail == _authProvider.CurrentUser.Email) //Don't process messages by yourself
return;
await SaveAnnotationInner(
@@ -106,7 +106,7 @@ public class AnnotationService : INotificationHandler<AnnotationsDeletedEvent>
{
a.Time = TimeSpan.FromMilliseconds(a.Milliseconds);
return await SaveAnnotationInner(DateTime.Now, a.OriginalMediaName, a.Time, ".jpg", a.Detections.ToList(),
a.Source, new MemoryStream(a.Image), a.CreatedRole, a.CreatedEmail, generateThumbnail: true, cancellationToken);
a.Source, new MemoryStream(a.Image), _authProvider.CurrentUser.Role, _authProvider.CurrentUser.Email, generateThumbnail: true, cancellationToken);
}
//Manual
+2 -1
View File
@@ -76,8 +76,9 @@ public class FailsafeAnnotationsProducer
await _annotationConfirmProducer.Send(validatedMessages, CompressionType.Gzip);
await _dbFactory.Run(async db =>
await db.AnnotationsQueue.DeleteAsync(aq => messagesChunk.Any(x => aq.Name == x.OriginalMediaName), token: cancellationToken));
await db.AnnotationsQueue.DeleteAsync(aq => messagesChunk.Any(x => aq.Name == x.Name), token: cancellationToken));
sent = true;
_dbFactory.SaveToDisk();
}
catch (Exception e)
{