mirror of
https://github.com/codex-storage/das-research.git
synced 2025-02-24 00:38:26 +00:00
add random scheduler
This commit is contained in:
parent
0f4883bf26
commit
1403ca7ad0
@ -321,6 +321,35 @@ class Validator:
|
|||||||
|
|
||||||
self.sendQueue.popleft()
|
self.sendQueue.popleft()
|
||||||
|
|
||||||
|
tries = 100
|
||||||
|
while tries:
|
||||||
|
if self.rowIDs:
|
||||||
|
rID = random.choice(self.rowIDs)
|
||||||
|
cID = random.randrange(0, self.shape.blockSize)
|
||||||
|
if self.block.getSegment(rID, cID) :
|
||||||
|
neigh = random.choice(list(self.rowNeighbors[rID].values()))
|
||||||
|
if not neigh.sent[cID] and not neigh.receiving[cID] :
|
||||||
|
neigh.sent[cID] = 1
|
||||||
|
neigh.node.receiveSegment(rID, cID, self.ID)
|
||||||
|
self.statsTxInSlot += 1
|
||||||
|
tries = 100
|
||||||
|
if self.statsTxInSlot >= self.bwUplink:
|
||||||
|
return
|
||||||
|
if self.columnIDs:
|
||||||
|
cID = random.choice(self.columnIDs)
|
||||||
|
rID = random.randrange(0, self.shape.blockSize)
|
||||||
|
if self.block.getSegment(rID, cID) :
|
||||||
|
neigh = random.choice(list(self.columnNeighbors[cID].values()))
|
||||||
|
if not neigh.sent[rID] and not neigh.receiving[rID] :
|
||||||
|
neigh.sent[rID] = 1
|
||||||
|
neigh.node.receiveSegment(rID, cID, self.ID)
|
||||||
|
self.statsTxInSlot += 1
|
||||||
|
tries = 100
|
||||||
|
tries -= 1
|
||||||
|
if self.statsTxInSlot >= self.bwUplink:
|
||||||
|
return
|
||||||
|
return
|
||||||
|
|
||||||
for n in self.sched:
|
for n in self.sched:
|
||||||
neigh = n.neigh
|
neigh = n.neigh
|
||||||
toSend = n.toSend
|
toSend = n.toSend
|
||||||
|
Loading…
x
Reference in New Issue
Block a user