feat(worker): lab6 record job outcomes and end-to-end readiness latency

This commit is contained in:
Голиков Maximillian Антон
2026-11-16 21:55:01 +03:00
parent 6558fb5497
commit 44c755f00c
4 changed files with 105 additions and 20 deletions
+2 -3
View File
@@ -108,7 +108,6 @@ func (s *AttachmentService) Upload(
sha := sha256.Sum256(buf)
id := uuid.NewString()
stagingKey := "staging/" + id
now := time.Now().UTC()
a := &domain.Attachment{
ID: id,
@@ -122,8 +121,6 @@ func (s *AttachmentService) Upload(
Status: domain.AttachmentStatusQueued,
StagingKey: stagingKey,
PipelineVersion: 1,
CreatedAt: now,
UpdatedAt: now,
}
if err := s.storage.Put(ctx, stagingKey, bytes.NewReader(buf), int64(len(buf)), contentType); err != nil {
@@ -140,6 +137,8 @@ func (s *AttachmentService) Upload(
}
err = s.tx.WithTx(ctx, func(tx domain.Tx) error {
a.CreatedAt = time.Now().UTC()
a.UpdatedAt = a.CreatedAt
if err := s.attachments.CreateInTx(ctx, tx, a); err != nil {
return err
}