fix: use current sequence for refetching of events (#5772)

* fix: use current sequence for refetching of events

* fix: use client ids
This commit is contained in:
Livio Spring
2023-04-28 16:28:13 +02:00
committed by GitHub
parent c8c5cf3c5f
commit 458a383de2
28 changed files with 273 additions and 107 deletions

View File

@@ -44,16 +44,16 @@ func (repo *TokenVerifierRepo) tokenByID(ctx context.Context, tokenID, userID st
defer func() { span.EndWithError(err) }()
instanceID := authz.GetInstance(ctx).InstanceID()
sequence, err := repo.View.GetLatestTokenSequence(instanceID)
logging.WithFields("instanceID", instanceID, "userID", userID, "tokenID").
OnError(err).
Errorf("could not get current sequence for token check")
token, viewErr := repo.View.TokenByIDs(tokenID, userID, instanceID)
if viewErr != nil && !caos_errs.IsNotFound(viewErr) {
return nil, viewErr
}
if caos_errs.IsNotFound(viewErr) {
sequence, err := repo.View.GetLatestTokenSequence(ctx, instanceID)
logging.WithFields("instanceID", instanceID, "userID", userID, "tokenID", tokenID).
OnError(err).
Errorf("could not get current sequence for token check")
token = new(model.TokenView)
token.ID = tokenID
token.UserID = userID