Skip to content

Commit

Permalink
Moves event out of orm transaction
Browse files Browse the repository at this point in the history
Signed-off-by: ianseyer <iseyer@cloudflare.com>
  • Loading branch information
iseyer committed Feb 25, 2025
1 parent 0b53158 commit 61b8261
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/controller/tag/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,24 @@ func (c *controller) Ensure(ctx context.Context, repositoryID, artifactID int64,

tagID, err = c.Create(ctx, tag)

attachedArtifact, err := c.artMgr.Get(ctx, tag.ArtifactID)
if err != nil {
return err
}

e := &metadata.CreateTagEventMetadata{
Ctx: ctx,
Tag: tag.Name,
AttachedArtifact: attachedArtifact,
}

notification.AddEvent(ctx, e)

return err
})(orm.SetTransactionOpNameToContext(ctx, "tx-tag-ensure")); err != nil && !errors.IsConflictErr(err) {
return 0, err
}

attachedArtifact, err := c.artMgr.Get(ctx, artifactID)
if err != nil {
return 0, err
}

e := &metadata.CreateTagEventMetadata{
Ctx: ctx,
Tag: name,
AttachedArtifact: attachedArtifact,
}

notification.AddEvent(ctx, e)

return tagID, nil
}

Expand Down

0 comments on commit 61b8261

Please # to comment.