From dd1e901dd99b73dfc98553595ce63567f2777870 Mon Sep 17 00:00:00 2001 From: rithu john Date: Tue, 11 Apr 2017 10:48:08 -0700 Subject: [PATCH] server/rotation.go: avoid displaying the "keys already rotated" error --- server/rotation.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/rotation.go b/server/rotation.go index 5619b3a7..c7c87126 100644 --- a/server/rotation.go +++ b/server/rotation.go @@ -5,7 +5,6 @@ import ( "crypto/rand" "crypto/rsa" "encoding/hex" - "errors" "fmt" "io" "time" @@ -125,8 +124,11 @@ func (k keyRotater) rotate() error { var nextRotation time.Time err = k.Storage.UpdateKeys(func(keys storage.Keys) (storage.Keys, error) { tNow := k.now() + + // if you are running multiple instances of dex, another instance + // could have already rotated the keys. if tNow.Before(keys.NextRotation) { - return storage.Keys{}, errors.New("keys already rotated") + return storage.Keys{}, nil } expired := func(key storage.VerificationKey) bool {