spelling: rotator

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
This commit is contained in:
Josh Soref 2020-12-19 22:01:56 -05:00
parent 791ad900cb
commit 3f8fdbf314
2 changed files with 7 additions and 7 deletions

View File

@ -55,7 +55,7 @@ func defaultRotationStrategy(rotationFrequency, idTokenValidFor time.Duration) r
}
}
type keyRotater struct {
type keyRotator struct {
storage.Storage
strategy rotationStrategy
@ -69,10 +69,10 @@ type keyRotater struct {
// The method blocks until after the first attempt to rotate keys has completed. That way
// healthy storages will return from this call with valid keys.
func (s *Server) startKeyRotation(ctx context.Context, strategy rotationStrategy, now func() time.Time) {
rotater := keyRotater{s.storage, strategy, now, s.logger}
rotator := keyRotator{s.storage, strategy, now, s.logger}
// Try to rotate immediately so properly configured storages will have keys.
if err := rotater.rotate(); err != nil {
if err := rotator.rotate(); err != nil {
if err == errAlreadyRotated {
s.logger.Infof("Key rotation not needed: %v", err)
} else {
@ -86,7 +86,7 @@ func (s *Server) startKeyRotation(ctx context.Context, strategy rotationStrategy
case <-ctx.Done():
return
case <-time.After(time.Second * 30):
if err := rotater.rotate(); err != nil {
if err := rotator.rotate(); err != nil {
s.logger.Errorf("failed to rotate keys: %v", err)
}
}
@ -94,7 +94,7 @@ func (s *Server) startKeyRotation(ctx context.Context, strategy rotationStrategy
}()
}
func (k keyRotater) rotate() error {
func (k keyRotator) rotate() error {
keys, err := k.GetKeys()
if err != nil && err != storage.ErrNotFound {
return fmt.Errorf("get keys: %v", err)

View File

@ -57,7 +57,7 @@ func slicesEq(s1, s2 []string) bool {
return true
}
func TestKeyRotater(t *testing.T) {
func TestKeyRotator(t *testing.T) {
now := time.Now()
delta := time.Millisecond
@ -73,7 +73,7 @@ func TestKeyRotater(t *testing.T) {
Level: logrus.DebugLevel,
}
r := &keyRotater{
r := &keyRotator{
Storage: memory.New(l),
strategy: defaultRotationStrategy(rotationFrequency, validFor),
now: func() time.Time { return now },