@@ -37,7 +37,7 @@ func (p *service) backupTimelockStateWorker(serviceCtx context.Context, interval
3737
3838 delay := 0 * time .Second // Initially no delay, so we can run right after a deploy
3939 cursor := query .EmptyCursor
40- oldestRecord := time .Now ()
40+ oldestRecordTs := time .Now ()
4141 for {
4242 select {
4343 case <- time .After (delay ):
@@ -58,11 +58,12 @@ func (p *service) backupTimelockStateWorker(serviceCtx context.Context, interval
5858 )
5959 if err == timelock .ErrTimelockNotFound {
6060 p .metricStatusLock .Lock ()
61- p .oldestTimelockRecord = & oldestRecord
61+ copiedTs := oldestRecordTs
62+ p .oldestTimelockRecord = & copiedTs
6263 p .metricStatusLock .Unlock ()
6364
6465 cursor = query .EmptyCursor
65- oldestRecord = time .Now ()
66+ oldestRecordTs = time .Now ()
6667 return
6768 } else if err != nil {
6869 log .WithError (err ).Warn ("failed to get timelock records" )
@@ -73,8 +74,8 @@ func (p *service) backupTimelockStateWorker(serviceCtx context.Context, interval
7374 for _ , timelockRecord := range timelockRecords {
7475 wg .Add (1 )
7576
76- if timelockRecord .LastUpdatedAt .Before (oldestRecord ) {
77- oldestRecord = timelockRecord .LastUpdatedAt
77+ if timelockRecord .LastUpdatedAt .Before (oldestRecordTs ) {
78+ oldestRecordTs = timelockRecord .LastUpdatedAt
7879 }
7980
8081 go func (timelockRecord * timelock.Record ) {
0 commit comments