diff --git a/core/relation/service.go b/core/relation/service.go index a259e902c..c8f5447d2 100644 --- a/core/relation/service.go +++ b/core/relation/service.go @@ -62,9 +62,8 @@ func (s Service) Create(ctx context.Context, rel RelationV2) (RelationV2, error) return RelationV2{}, fmt.Errorf("%w: %s", ErrCreatingRelationInAuthzEngine, err.Error()) } - ctx = s.repository.WithoutTx(ctx) - go func() { + ctx = s.repository.WithoutTx(ctx) ctx = context.WithoutCancel(ctx) relationLogData := createdRelation.ToLogData() actor := activity.Actor{ID: currentUser.ID, Email: currentUser.Email} diff --git a/core/resource/service.go b/core/resource/service.go index addbfb26a..6168567a5 100644 --- a/core/resource/service.go +++ b/core/resource/service.go @@ -188,10 +188,9 @@ func (s Service) Create(ctx context.Context, res Resource) (Resource, error) { return Resource{}, err } - ctx = s.repository.WithoutTx(ctx) - go func() { - ctx = context.WithoutCancel(ctx) + ctx = s.repository.WithoutTx(ctx) + ctx := context.WithoutCancel(ctx) resourceLogData := newResource.ToLogData() actor := activity.Actor{ID: currentUser.ID, Email: currentUser.Email} if err := s.activityService.Log(ctx, auditKeyResourceCreate, actor, resourceLogData); err != nil { diff --git a/core/servicedata/service.go b/core/servicedata/service.go index 1da6a8cfc..eb53ead0a 100644 --- a/core/servicedata/service.go +++ b/core/servicedata/service.go @@ -146,9 +146,8 @@ func (s Service) CreateKey(ctx context.Context, key Key) (Key, error) { return Key{}, err } - ctx = s.repository.WithoutTx(ctx) - go func() { + ctx = s.repository.WithoutTx(ctx) ctx = context.WithoutCancel(ctx) actor := activity.Actor{ID: currentUser.ID, Email: currentUser.Email} if err := s.activityService.Log(ctx, auditKeyServiceDataKeyCreate, actor, key.ToKeyLogData()); err != nil {