Skip to content

Commit f843e46

Browse files
committed
stream: deduplicate share min cursor updates
1 parent e87334e commit f843e46

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/internal/streams/iter/share.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,14 @@ class ShareImpl {
366366
#deleteConsumerFromMin(consumer) {
367367
if (consumer.cursor === this.#cachedMinCursor) {
368368
this.#cachedMinCursorConsumers--;
369+
return this.#cachedMinCursorConsumers === 0;
369370
}
371+
return false;
370372
}
371373

372374
#deleteConsumer(consumer) {
373375
if (this.#consumers.delete(consumer)) {
374-
const wasAtMin = consumer.cursor === this.#cachedMinCursor;
375-
this.#deleteConsumerFromMin(consumer);
376-
return wasAtMin && this.#cachedMinCursorConsumers === 0;
376+
return this.#deleteConsumerFromMin(consumer);
377377
}
378378
return false;
379379
}
@@ -615,14 +615,14 @@ class SyncShareImpl {
615615
#deleteConsumerFromMin(consumer) {
616616
if (consumer.cursor === this.#cachedMinCursor) {
617617
this.#cachedMinCursorConsumers--;
618+
return this.#cachedMinCursorConsumers === 0;
618619
}
620+
return false;
619621
}
620622

621623
#deleteConsumer(consumer) {
622624
if (this.#consumers.delete(consumer)) {
623-
const wasAtMin = consumer.cursor === this.#cachedMinCursor;
624-
this.#deleteConsumerFromMin(consumer);
625-
return wasAtMin && this.#cachedMinCursorConsumers === 0;
625+
return this.#deleteConsumerFromMin(consumer);
626626
}
627627
return false;
628628
}

0 commit comments

Comments
 (0)