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

Method unsafeOffer

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

Source from the content-addressed store, hash-verified

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") {

Callers

nothing calls this directly

Calls 2

unsafeTakeMethod · 0.95
scheduleReleaseTakerMethod · 0.95

Tested by

no test coverage detected