fixup: segmentShuffleScheduler

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-02-16 09:19:45 +01:00
parent bb55abe2b0
commit f91f3da5d2
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
1 changed files with 6 additions and 3 deletions

View File

@ -410,9 +410,9 @@ class Validator:
# one neighbor needing it). Then it sends each segment that's worth sending
# once, in shuffled order. This is repeated until bw limit.
while True:
if hasattr(self, 'segmentsToSend') and self.segmentsToSend:
self.logger.debug("TX:%d q:%d", self.statsTxInSlot, len(self.segmentsToSend), extra=self.format)
for s in shuffled(self.segmentsToSend):
if hasattr(self, 'segmentShuffleGen') and self.segmentShuffleGen is not None:
#self.logger.debug("TX:%d queue:%d", self.statsTxInSlot, len(self.segmentsToSend), extra=self.format)
for s in self.segmentShuffleGen:
self.logger.debug("%d:%d/%d", s.dim, s.id, s.i, extra=self.format)
if s.dim == 0:
for _, neigh in shuffledDict(self.rowNeighbors[s.id], self.shuffleNeighbors):
@ -433,6 +433,7 @@ class Validator:
if not self.segmentShuffleSchedulerPersist:
# remove scheduler state before leaving
self.segmentsToSend = []
self.segmentShuffleGen = None
return
self.segmentsToSend = []
@ -460,6 +461,8 @@ class Validator:
if not self.segmentsToSend:
break
else:
self.segmentShuffleGen = shuffled(self.segmentsToSend)
if self.dumbRandomScheduler:
# dumb random scheduler picking segments at random and trying to send it