From dabdc5e52b554f48cc33cffe67700aa552592050 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Fri, 26 Aug 2016 17:40:21 -0700 Subject: [PATCH] Fix access race in proxy scheduler Signed-off-by: Derek McGowan (github: dmcgowan) --- registry/proxy/scheduler/scheduler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/registry/proxy/scheduler/scheduler.go b/registry/proxy/scheduler/scheduler.go index 0c8a8534..bde94657 100644 --- a/registry/proxy/scheduler/scheduler.go +++ b/registry/proxy/scheduler/scheduler.go @@ -134,11 +134,12 @@ func (ttles *TTLExpirationScheduler) Start() error { for { select { case <-ttles.saveTimer.C: + ttles.Lock() if !ttles.indexDirty { + ttles.Unlock() continue } - ttles.Lock() err := ttles.writeState() if err != nil { context.GetLogger(ttles.ctx).Errorf("Error writing scheduler state: %s", err)