14360: Cut excess time.Now() calls.
authorTom Clegg <tclegg@veritasgenetics.com>
Sat, 27 Oct 2018 04:31:43 +0000 (00:31 -0400)
committerTom Clegg <tclegg@veritasgenetics.com>
Sat, 27 Oct 2018 04:31:43 +0000 (00:31 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg@veritasgenetics.com>

lib/dispatchcloud/worker/pool.go

index fc87ea42187c8268f72d311c82955d077a3504df..74d3d517295691bf9577d4c7fa9ec150489c4b32 100644 (file)
@@ -257,15 +257,16 @@ func (wp *Pool) updateWorker(inst cloud.Instance, it arvados.InstanceType, initi
                "Instance":     inst,
                "State":        initialState,
        }).Infof("instance appeared in cloud")
+       now := time.Now()
        wp.workers[id] = &worker{
                executor:    wp.newExecutor(inst),
                state:       initialState,
                instance:    inst,
                instType:    it,
-               probed:      time.Now(),
-               busy:        time.Now(),
-               updated:     time.Now(),
-               unallocated: time.Now(),
+               probed:      now,
+               busy:        now,
+               updated:     now,
+               unallocated: now,
                running:     make(map[string]struct{}),
                starting:    make(map[string]struct{}),
                probing:     make(chan struct{}, 1),