mirror of
https://github.com/codex-storage/codex-research.git
synced 2025-02-03 14:25:48 +00:00
Add queue pausing and prevention of small availabilities from clearing queue
This commit is contained in:
parent
cddf363b85
commit
36ed175c81
@ -174,6 +174,7 @@ Slots in the queue should be sorted in the following order:
|
||||
2. Collateral required (ascending)
|
||||
3. Time before expiry (descending)
|
||||
4. Dataset size (ascending)
|
||||
5. Seen flag
|
||||
|
||||
<sup>1</sup> While profit cannot yet be calculated correctly as this calculation will
|
||||
involve bandwidth incentives, profit can be estimated as `duration * reward`
|
||||
@ -208,6 +209,27 @@ mechanism](https://github.com/codex-storage/codex-research/blob/master/design/ma
|
||||
If the host is not allowed to fill the slot, the sales process will exit and the
|
||||
host will process the top slot in the queue.
|
||||
|
||||
#### Preventing continual processing when there are small availabilities
|
||||
If the processed slot cannot continue because there are no availabilities, the
|
||||
slot should be marked as `seen` and put back into the queue. This flag will
|
||||
cause the slot to be ordered lower in the heap queue. If, upon processing
|
||||
a slot, the slot item already has a `seen` flag set, the queue should be
|
||||
paused.
|
||||
|
||||
This serves to prevent availabilities that are small (in avaialble bytes) from
|
||||
emptying the queue.
|
||||
|
||||
#### Pausing the queue
|
||||
When availabilities are modified or removed, and there are no availabilities
|
||||
left, the queue should be paused.
|
||||
|
||||
A paused queue will wait until it is unpaused before continuing to process items
|
||||
in the queue. This prevents unnecessarily popping items off the queue.
|
||||
|
||||
#### Unpausing the queue
|
||||
When availabilities are modified or added, the queue should be unpaused if it
|
||||
was paused and any slots in the queue should have their `seen` flag cleared.
|
||||
|
||||
#### Queue workers
|
||||
Each time an item in the queue is processed, it is assigned to a workers. The
|
||||
number of allowed workers can be specified during queue creation. Specifying a
|
||||
|
Loading…
x
Reference in New Issue
Block a user