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:
@@ -41,6 +41,9 @@ func (s SchemasHandlerFunc) OnSchemas(schemas *schema2.Collection, changedSchema
|
|||||||
type handler struct {
|
type handler struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
|
|
||||||
|
// refreshLock prevents refreshAll to be run in parallel
|
||||||
|
refreshLock sync.Mutex
|
||||||
|
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
toSync int32
|
toSync int32
|
||||||
schemas *schema2.Collection
|
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 {
|
func (h *handler) refreshAll(ctx context.Context, changedGVKs map[k8sapimachineryschema.GroupVersionKind]bool, forceChange bool) error {
|
||||||
h.Lock()
|
h.refreshLock.Lock()
|
||||||
defer h.Unlock()
|
defer h.refreshLock.Unlock()
|
||||||
|
|
||||||
if !h.needToSync() {
|
if !h.needToSync() {
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user