Преглед на файлове

p2p/tracker: only reschedule wake if previous didn't run

Péter Szilágyi преди 4 години
родител
ревизия
ff3535e8e0
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      p2p/tracker/tracker.go

+ 3 - 2
p2p/tracker/tracker.go

@@ -188,8 +188,9 @@ func (t *Tracker) Fulfil(peer string, version uint, code uint64, id uint64) {
 	t.expire.Remove(req.expire)
 	delete(t.pending, id)
 	if req.expire.Prev() == nil {
-		t.wake.Stop()
-		t.schedule()
+		if t.wake.Stop() {
+			t.schedule()
+		}
 	}
 	g := fmt.Sprintf("%s/%s/%d/%#02x", trackedGaugeName, t.protocol, req.version, req.reqCode)
 	metrics.GetOrRegisterGauge(g, nil).Dec(1)