diff --git a/pkg/services/authn/authnimpl/sync/user_sync.go b/pkg/services/authn/authnimpl/sync/user_sync.go index 8df04dee712..fb2c0b02b29 100644 --- a/pkg/services/authn/authnimpl/sync/user_sync.go +++ b/pkg/services/authn/authnimpl/sync/user_sync.go @@ -158,6 +158,7 @@ func (s *UserSync) SyncLastSeenHook(ctx context.Context, identity *authn.Identit return nil } + goCtx := context.WithoutCancel(ctx) go func(userID int64) { defer func() { if err := recover(); err != nil { @@ -165,7 +166,7 @@ func (s *UserSync) SyncLastSeenHook(ctx context.Context, identity *authn.Identit } }() - if err := s.userService.UpdateLastSeenAt(context.Background(), + if err := s.userService.UpdateLastSeenAt(goCtx, &user.UpdateUserLastSeenAtCommand{UserID: userID, OrgID: r.OrgID}); err != nil && !errors.Is(err, user.ErrLastSeenUpToDate) { s.log.Error("Failed to update last_seen_at", "err", err, "userId", userID) diff --git a/pkg/services/user/userimpl/user.go b/pkg/services/user/userimpl/user.go index da1f144b74c..e7168251986 100644 --- a/pkg/services/user/userimpl/user.go +++ b/pkg/services/user/userimpl/user.go @@ -313,7 +313,7 @@ func shouldUpdateLastSeen(t time.Time) bool { } func (s *Service) GetSignedInUser(ctx context.Context, query *user.GetSignedInUserQuery) (*user.SignedInUser, error) { - ctx, span := s.tracer.Start(ctx, "user.GetSignedInUserWithCacheCtx", trace.WithAttributes( + ctx, span := s.tracer.Start(ctx, "user.GetSignedInUser", trace.WithAttributes( attribute.Int64("userID", query.UserID), attribute.Int64("orgID", query.OrgID), ))