Remove cancelled pushes and shifts at the end of every processOrders() call;
This commit is contained in:
parent
261a23f479
commit
f41bf220df
1 changed files with 14 additions and 0 deletions
14
lib/index.js
14
lib/index.js
|
@ -104,6 +104,20 @@ const Channel = function(length = 0) {
|
||||||
|
|
||||||
pushes.splice(0, index.push);
|
pushes.splice(0, index.push);
|
||||||
shifts.splice(0, index.shift);
|
shifts.splice(0, index.shift);
|
||||||
|
|
||||||
|
// Remove cancelled pushes
|
||||||
|
for (let i = pushes.length - 1; i >= 0; i--) {
|
||||||
|
if (pushes[i].cancelled) {
|
||||||
|
pushes.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove cancelled shifts
|
||||||
|
for (let i = shifts.length - 1; i >= 0; i--) {
|
||||||
|
if (shifts[i].cancelled) {
|
||||||
|
shifts.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const readOnly = Object.freeze(
|
const readOnly = Object.freeze(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue