(streamName, timeout)
| 7698 | } |
| 7699 | |
| 7700 | createConsumer(streamName, timeout) { |
| 7701 | let mainStreamConsumer = this._mainStream.createConsumer(timeout); |
| 7702 | |
| 7703 | let consumerNext = mainStreamConsumer.next; |
| 7704 | mainStreamConsumer.next = async function () { |
| 7705 | while (true) { |
| 7706 | let packet = await consumerNext.apply(this, arguments); |
| 7707 | if (packet.value) { |
| 7708 | if ( |
| 7709 | packet.value.stream === streamName || |
| 7710 | packet.value.consumerId === this.id |
| 7711 | ) { |
| 7712 | if (packet.value.data.done) { |
| 7713 | this.return(); |
| 7714 | } |
| 7715 | return packet.value.data; |
| 7716 | } |
| 7717 | } |
| 7718 | if (packet.done) { |
| 7719 | return packet; |
| 7720 | } |
| 7721 | } |
| 7722 | }; |
| 7723 | |
| 7724 | let consumerGetStats = mainStreamConsumer.getStats; |
| 7725 | mainStreamConsumer.getStats = function () { |
| 7726 | let stats = consumerGetStats.apply(this, arguments); |
| 7727 | stats.stream = streamName; |
| 7728 | return stats; |
| 7729 | }; |
| 7730 | |
| 7731 | let consumerApplyBackpressure = mainStreamConsumer.applyBackpressure; |
| 7732 | mainStreamConsumer.applyBackpressure = function (packet) { |
| 7733 | if (packet.value) { |
| 7734 | if ( |
| 7735 | packet.value.stream === streamName || |
| 7736 | packet.value.consumerId === this.id |
| 7737 | ) { |
| 7738 | consumerApplyBackpressure.apply(this, arguments); |
| 7739 | |
| 7740 | return; |
| 7741 | } |
| 7742 | } |
| 7743 | if (packet.done) { |
| 7744 | consumerApplyBackpressure.apply(this, arguments); |
| 7745 | } |
| 7746 | }; |
| 7747 | |
| 7748 | let consumerReleaseBackpressure = mainStreamConsumer.releaseBackpressure; |
| 7749 | mainStreamConsumer.releaseBackpressure = function (packet) { |
| 7750 | if (packet.value) { |
| 7751 | if ( |
| 7752 | packet.value.stream === streamName || |
| 7753 | packet.value.consumerId === this.id |
| 7754 | ) { |
| 7755 | consumerReleaseBackpressure.apply(this, arguments); |
| 7756 | |
| 7757 | return; |
nothing calls this directly
no test coverage detected