(message: A)
| 117 | }) |
| 118 | } |
| 119 | unsafeOffer(message: A): boolean { |
| 120 | if (this.state._tag !== "Open") { |
| 121 | return false |
| 122 | } else if (this.messages.length + this.messagesChunk.length >= this.capacity) { |
| 123 | if (this.strategy === "sliding") { |
| 124 | this.unsafeTake() |
| 125 | this.messages.push(message) |
| 126 | return true |
| 127 | } else if (this.capacity <= 0 && this.state.takers.size > 0) { |
| 128 | this.messages.push(message) |
| 129 | this.releaseTaker() |
| 130 | return true |
| 131 | } |
| 132 | return false |
| 133 | } |
| 134 | this.messages.push(message) |
| 135 | this.scheduleReleaseTaker() |
| 136 | return true |
| 137 | } |
| 138 | offerAll(messages: Iterable<A>): Effect<Chunk.Chunk<A>> { |
| 139 | return core.suspend(() => { |
| 140 | if (this.state._tag !== "Open") { |
nothing calls this directly
no test coverage detected