Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
finale
  • Loading branch information
sreya committed Oct 1, 2024
commit 05dec8a8cc3a3e39bca42f77306abfcdf2bcdc0b
8 changes: 8 additions & 0 deletions coderd/cryptokeys/dbkeycache.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (d *DBCache) Verifying(ctx context.Context, sequence int32) (codersdk.Crypt
d.keysMu.Lock()
defer d.keysMu.Unlock()

if d.closed {
return codersdk.CryptoKey{}, ErrClosed
}

key, ok = d.keys[sequence]
if ok {
return checkKey(key, now)
Expand Down Expand Up @@ -120,6 +124,10 @@ func (d *DBCache) Signing(ctx context.Context) (codersdk.CryptoKey, error) {
d.keysMu.Lock()
defer d.keysMu.Unlock()

if d.closed {
return codersdk.CryptoKey{}, ErrClosed
}

if d.latestKey.CanSign(now) {
return db2sdk.CryptoKey(d.latestKey), nil
}
Expand Down
Loading