forked from mtusi2026/mtusi2026lab6
feat(worker): lab6 record job outcomes and end-to-end readiness latency
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user