Skip to content

Commit

Permalink
Log the amount of replicaes Redis wrote to
Browse files Browse the repository at this point in the history
  • Loading branch information
DibranMulder committed Jan 30, 2025
1 parent d389b45 commit 17dfe88
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions server/irmaserver/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,11 @@ func (s *redisSessionStore) add(ctx context.Context, session *sessionData) error
}

if s.client.FailoverMode {
if err := s.client.Wait(ctx, 1, time.Second).Err(); err != nil {
replicas, err := s.client.Wait(ctx, 1, time.Second).Result()
if err != nil {
return err
}
s.conf.Logger.WithFields(logrus.Fields{"session": session.RequestorToken, "replicas": replicas}).Debug("Redis datastore acknowledged write")
}
return nil
}); err != nil {
Expand Down Expand Up @@ -349,9 +351,13 @@ func (s *redisSessionStore) clientTransaction(ctx context.Context, t irma.Client
return err
}
if s.client.FailoverMode {
if err := tx.Wait(ctx, 1, time.Second).Err(); err != nil {
replicas, err := s.client.Wait(ctx, 1, time.Second).Result()
if err != nil {
return err
}
s.conf.Logger.
WithFields(logrus.Fields{"session": session.RequestorToken, "replicas": replicas}).
Debug("Redis datastore acknowledged write")
}
return nil
})
Expand Down
8 changes: 6 additions & 2 deletions server/keyshare/myirmaserver/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ func (s *redisSessionStore) add(ctx context.Context, ses session) error {
return err
}
if s.client.FailoverMode {
if err := tx.Wait(ctx, 1, time.Second).Err(); err != nil {
replicas, err := s.client.Wait(ctx, 1, time.Second).Result()
if err != nil {
return err
}
s.logger.WithFields(logrus.Fields{"replicas": replicas}).Debug("Redis datastore acknowledged write")
}
return nil
}); err != nil {
Expand Down Expand Up @@ -150,9 +152,11 @@ func (s *redisSessionStore) update(ctx context.Context, token string, handler fu
}

if s.client.FailoverMode {
if err := tx.Wait(ctx, 1, time.Second).Err(); err != nil {
replicas, err := s.client.Wait(ctx, 1, time.Second).Result()
if err != nil {
return err
}
s.logger.WithFields(logrus.Fields{"replicas": replicas}).Debug("Redis datastore acknowledged write")
}
return nil
})
Expand Down

0 comments on commit 17dfe88

Please sign in to comment.