MCPcopy Create free account
hub / github.com/Noumena-Network/code / tryPush

Method tryPush

src/remote/appServer/client.ts:182–196  ·  view source on GitHub ↗
(value: T)

Source from the content-addressed store, hash-verified

180 constructor(private readonly capacity: number) {}
181
182 tryPush(value: T): boolean {
183 if (this.closed) {
184 return false
185 }
186 const waiter = this.waiters.shift()
187 if (waiter) {
188 waiter(value)
189 return true
190 }
191 if (this.queue.length >= this.capacity) {
192 return false
193 }
194 this.queue.push(value)
195 return true
196 }
197
198 pushLossless(value: T): boolean {
199 if (this.closed) {

Callers 1

enqueueEventMethod · 0.80

Calls 1

shiftMethod · 0.80

Tested by

no test coverage detected