mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:46:30 +00:00
fix datasetexplorer view
save annotation with detections fix sending to queue
This commit is contained in:
@@ -65,13 +65,15 @@ public class FailsafeAnnotationsProducer
|
||||
.Where(x => x.Status == AnnotationStatus.Created)
|
||||
.Select(x => new Message(MessagePackSerializer.Serialize(x)))
|
||||
.ToList();
|
||||
await _annotationProducer.Send(createdMessages, CompressionType.Gzip);
|
||||
if (createdMessages.Any())
|
||||
await _annotationProducer.Send(createdMessages, CompressionType.Gzip);
|
||||
|
||||
var validatedMessages = messagesChunk
|
||||
.Where(x => x.Status == AnnotationStatus.Validated)
|
||||
.Select(x => new Message(MessagePackSerializer.Serialize(x)))
|
||||
.ToList();
|
||||
await _annotationConfirmProducer.Send(validatedMessages, CompressionType.Gzip);
|
||||
if (validatedMessages.Any())
|
||||
await _annotationConfirmProducer.Send(validatedMessages, CompressionType.Gzip);
|
||||
|
||||
await _dbFactory.Run(async db =>
|
||||
await db.AnnotationsQueue.DeleteAsync(aq => messagesChunk.Any(x => aq.Name == x.Name), token: cancellationToken));
|
||||
@@ -80,10 +82,12 @@ public class FailsafeAnnotationsProducer
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, e.Message);
|
||||
await Task.Delay(TimeSpan.FromSeconds(30), cancellationToken);
|
||||
await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken);
|
||||
}
|
||||
await Task.Delay(TimeSpan.FromSeconds(10), cancellationToken);
|
||||
}
|
||||
}
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +95,8 @@ public class FailsafeAnnotationsProducer
|
||||
{
|
||||
return await _dbFactory.Run(async db =>
|
||||
{
|
||||
var annotations = await db.AnnotationsQueue.Join(db.Annotations, aq => aq.Name, a => a.Name, (aq, a) => a)
|
||||
var annotations = await db.AnnotationsQueue.Join(
|
||||
db.Annotations.LoadWith(x => x.Detections), aq => aq.Name, a => a.Name, (aq, a) => a)
|
||||
.ToListAsync(token: cancellationToken);
|
||||
|
||||
var messages = new List<AnnotationCreatedMessage>();
|
||||
@@ -105,10 +110,13 @@ public class FailsafeAnnotationsProducer
|
||||
CreatedRole = annotation.CreatedRole,
|
||||
CreatedEmail = annotation.CreatedEmail,
|
||||
CreatedDate = annotation.CreatedDate,
|
||||
Status = annotation.AnnotationStatus,
|
||||
|
||||
ImageExtension = annotation.ImageExtension,
|
||||
Image = image,
|
||||
Detections = JsonConvert.SerializeObject(annotation.Detections),
|
||||
Source = annotation.Source
|
||||
Source = annotation.Source,
|
||||
|
||||
};
|
||||
messages.Add(annCreateMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user