MSP-7036 fix test races

This commit is contained in:
likhachevam committed 2026-02-13 17:06:52 +03:00
1 parent 1976e3aa29
commit 4da0d51b5b
3 files changed
+14 -9

No files matched your search

+5 -3
View File
@@ -95,11 +95,12 @@ func (s Audit) SaveAuditAsync(ctx context.Context, userId int64, message string,
}
func (s Audit) All(ctx context.Context, req domain.AuditPageRequest) (*domain.AuditResponse, error) {
group, ctx := errgroup.WithContext(ctx)
var logs []entity.Audit
var total int64
var err error
group, ctx := errgroup.WithContext(ctx)
group.Go(func() error {
var err error
logs, err = s.auditRep.All(ctx, req)
if err != nil {
return errors.WithMessage(err, "get all audit")
@@ -107,13 +108,14 @@ func (s Audit) All(ctx context.Context, req domain.AuditPageRequest) (*domain.Au
return nil
})
group.Go(func() error {
var err error
total, err = s.auditRep.Count(ctx)
if err != nil {
return errors.WithMessage(err, "count all audit")
}
return nil
})
err = group.Wait()
err := group.Wait()
if err != nil {
return nil, errors.WithMessage(err, "wait workers")
}
+5 -3
View File
@@ -75,11 +75,12 @@ func (s Token) RevokeAllByUserId(ctx context.Context, userId int64) error {
}
func (s Token) All(ctx context.Context, req domain.SessionPageRequest) (*domain.SessionResponse, error) {
group, ctx := errgroup.WithContext(ctx)
var tokens []entity.Token
var total int64
var err error
group, ctx := errgroup.WithContext(ctx)
group.Go(func() error {
var err error
tokens, err = s.tokenRep.All(ctx, req)
if err != nil {
return errors.WithMessage(err, "get all tokens")
@@ -87,13 +88,14 @@ func (s Token) All(ctx context.Context, req domain.SessionPageRequest) (*domain.
return nil
})
group.Go(func() error {
var err error
total, err = s.tokenRep.Count(ctx)
if err != nil {
return errors.WithMessage(err, "count all tokens")
}
return nil
})
err = group.Wait()
err := group.Wait()
if err != nil {
return nil, errors.WithMessage(err, "wait workers")
}