From: Tom Clegg Date: Fri, 21 Sep 2018 20:23:58 +0000 (-0400) Subject: 10181: Cleanup identifiers. X-Git-Tag: 1.3.0~97^2~11 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/e87d633ee2adaacedd56a74e5a249e6e753359e3?ds=inline 10181: Cleanup identifiers. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- diff --git a/services/crunch-run/crunchrun.go b/services/crunch-run/crunchrun.go index 4319757a64..157cc8184c 100644 --- a/services/crunch-run/crunchrun.go +++ b/services/crunch-run/crunchrun.go @@ -1178,13 +1178,13 @@ func (runner *ContainerRunner) WaitFinish() error { } func (runner *ContainerRunner) checkpointLogs() { - logCheckpointTicker := time.NewTicker(crunchLogCheckpointMaxDuration / 360) - defer logCheckpointTicker.Stop() + ticker := time.NewTicker(crunchLogCheckpointMaxDuration / 360) + defer ticker.Stop() - logCheckpointTime := time.Now().Add(crunchLogCheckpointMaxDuration) - logCheckpointBytes := crunchLogCheckpointMaxBytes + saveAtTime := time.Now().Add(crunchLogCheckpointMaxDuration) + saveAtSize := crunchLogCheckpointMaxBytes var savedSize int64 - for range logCheckpointTicker.C { + for range ticker.C { runner.logMtx.Lock() done := runner.LogsPDH != nil runner.logMtx.Unlock() @@ -1192,11 +1192,11 @@ func (runner *ContainerRunner) checkpointLogs() { return } size := runner.LogCollection.Size() - if size == savedSize || (time.Now().Before(logCheckpointTime) && size < logCheckpointBytes) { + if size == savedSize || (time.Now().Before(saveAtTime) && size < saveAtSize) { continue } - logCheckpointTime = time.Now().Add(crunchLogCheckpointMaxDuration) - logCheckpointBytes = runner.LogCollection.Size() + crunchLogCheckpointMaxBytes + saveAtTime = time.Now().Add(crunchLogCheckpointMaxDuration) + saveAtSize = runner.LogCollection.Size() + crunchLogCheckpointMaxBytes saved, err := runner.saveLogCollection() if err != nil { runner.CrunchLog.Printf("error updating log collection: %s", err)