Skip to content

Commit

Permalink
revert delays
Browse files Browse the repository at this point in the history
  • Loading branch information
awill1988 committed Oct 30, 2024
1 parent 2d0f13e commit 2e0884c
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions jwk/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ import (
"context"
"crypto/ecdsa"
"crypto/ed25519"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/json"
"encoding/pem"
"math/big"
"sync"
"time"

hydra "github.com/ory/hydra-client-go/v2"

Expand All @@ -32,13 +29,6 @@ import (
var mapLock sync.RWMutex
var locks = map[string]*sync.RWMutex{}

func lockDelay() (duration time.Duration) {
if n, err := rand.Int(rand.Reader, big.NewInt(3)); err == nil {
duration = time.Duration(n.Int64()) * time.Millisecond
}
return
}

func getLock(set string) *sync.RWMutex {
mapLock.Lock()
defer mapLock.Unlock()
Expand All @@ -64,7 +54,6 @@ func GetOrGenerateKeys(ctx context.Context, r InternalRegistry, m Manager, set,
return nil, err
}
} else {
time.Sleep(lockDelay())
return GetOrGenerateKeys(ctx, r, m, set, kid, alg)
}
} else if err != nil {
Expand Down Expand Up @@ -92,7 +81,6 @@ func GetOrGenerateKeys(ctx context.Context, r InternalRegistry, m Manager, set,
return privKey, nil
}

time.Sleep(lockDelay())
return GetOrGenerateKeys(ctx, r, m, set, kid, alg)
}

Expand Down

0 comments on commit 2e0884c

Please sign in to comment.