1
0
mirror of https://github.com/rancher/steve.git synced 2025-09-17 15:58:41 +00:00

Use a separate lock for refreshAll (#793)

This commit is contained in:
Tom Lebreux
2025-08-22 09:53:00 -04:00
committed by GitHub
parent 10d0492ae3
commit c4905647f1

View File

@@ -41,6 +41,9 @@ func (s SchemasHandlerFunc) OnSchemas(schemas *schema2.Collection, changedSchema
type handler struct {
sync.Mutex
// refreshLock prevents refreshAll to be run in parallel
refreshLock sync.Mutex
ctx context.Context
toSync int32
schemas *schema2.Collection
@@ -222,8 +225,8 @@ func (h *handler) getColumns(ctx context.Context, schemas map[string]*types.APIS
}
func (h *handler) refreshAll(ctx context.Context, changedGVKs map[k8sapimachineryschema.GroupVersionKind]bool, forceChange bool) error {
h.Lock()
defer h.Unlock()
h.refreshLock.Lock()
defer h.refreshLock.Unlock()
if !h.needToSync() {
return nil