mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-06 21:04:39 +02:00
storage: fix possible race condition with maps.Keys iterator (#5321)
This commit is contained in:
parent
2aea633f80
commit
2f8743522d
1 changed files with 3 additions and 3 deletions
|
@ -203,10 +203,10 @@ func (backend *Backend) Lease(_ context.Context, leaseName, leaseID string, ttl
|
||||||
// ListTypes lists the record types.
|
// ListTypes lists the record types.
|
||||||
func (backend *Backend) ListTypes(_ context.Context) ([]string, error) {
|
func (backend *Backend) ListTypes(_ context.Context) ([]string, error) {
|
||||||
backend.mu.Lock()
|
backend.mu.Lock()
|
||||||
keys := maps.Keys(backend.lookup)
|
defer backend.mu.Unlock()
|
||||||
backend.mu.Unlock()
|
keys := slices.Sorted(maps.Keys(backend.lookup))
|
||||||
|
|
||||||
return slices.Sorted(keys), nil
|
return keys, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put puts a record into the in-memory store.
|
// Put puts a record into the in-memory store.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue