MCPcopy Create free account
hub / github.com/Effect-TS/effect / unsafeOffer

Method unsafeOffer

packages/effect/src/internal/mailbox.ts:113–131  ·  view source on GitHub ↗
(message: A)

Source from the content-addressed store, hash-verified

111 })
112 }
113 unsafeOffer(message: A): boolean {
114 if (this.state._tag !== "Open") {
115 return false
116 } else if (this.messages.length + this.messagesChunk.length >= this.capacity) {
117 if (this.strategy === "sliding") {
118 this.unsafeTake()
119 this.messages.push(message)
120 return true
121 } else if (this.capacity <= 0 && this.state.takers.size > 0) {
122 this.messages.push(message)
123 this.releaseTaker()
124 return true
125 }
126 return false
127 }
128 this.messages.push(message)
129 this.scheduleReleaseTaker()
130 return true
131 }
132 offerAll(messages: Iterable<A>): Effect<Chunk.Chunk<A>> {
133 return core.suspend(() => {
134 if (this.state._tag !== "Open") {

Callers

nothing calls this directly

Calls 2

unsafeTakeMethod · 0.95
scheduleReleaseTakerMethod · 0.95

Tested by

no test coverage detected