Skip to content

Commit 6dd71b1

Browse files
authored
fix(coderd/cryptokeys): relock mutex to avoid double unlock (#16802)
1 parent f21fcbd commit 6dd71b1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

coderd/cryptokeys/cache.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ func (c *cache) cryptoKey(ctx context.Context, sequence int32) (string, []byte,
251251
}
252252

253253
c.fetching = true
254-
c.mu.Unlock()
255254

255+
c.mu.Unlock()
256256
keys, err := c.cryptoKeys(ctx)
257+
c.mu.Lock()
257258
if err != nil {
258259
return "", nil, xerrors.Errorf("get keys: %w", err)
259260
}
260261

261-
c.mu.Lock()
262262
c.lastFetch = c.clock.Now()
263263
c.refresher.Reset(refreshInterval)
264264
c.keys = keys

0 commit comments

Comments
 (0)