From 046b0cd41702264f04844b996026353e0482f6be Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Wed, 20 Mar 2024 13:20:41 +1100 Subject: [PATCH] PR feedback updates 1. Change `seen` to be the highest priority invariant 2. Add condition for clearing seen flags and unpausing queue 3. Fix typo --- design/sales.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/design/sales.md b/design/sales.md index dcf08cb..fdf02b9 100644 --- a/design/sales.md +++ b/design/sales.md @@ -170,11 +170,11 @@ state is validated. ### Sort order Slots in the queue should be sorted in the following order: -1. Profit (descending)1 -2. Collateral required (ascending) -3. Time before expiry (descending) -4. Dataset size (ascending) -5. Seen flag +1. Seen flag +2. Profit (descending)1 +3. Collateral required (ascending) +4. Time before expiry (descending) +5. Dataset size (ascending) 1 While profit cannot yet be calculated correctly as this calculation will involve bandwidth incentives, profit can be estimated as `duration * reward` @@ -216,7 +216,7 @@ 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 +This serves to prevent availabilities that are small (in available bytes) from emptying the queue. #### Pausing the queue @@ -227,8 +227,10 @@ 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. +The queue should be unpaused if it was paused and any slots in the queue should +have their `seen` flag cleared, when: +1. availabilities are modified or added +2. slots are pushed to the queue #### Queue workers Each time an item in the queue is processed, it is assigned to a workers. The