MCPcopy
hub / github.com/coder/mux / addOnce

Method addOnce

src/node/services/messageQueue.ts:151–166  ·  view source on GitHub ↗

* Add a message to the queue once, keyed by dedupeKey. * Returns true if the message was queued.

(
    message: string,
    options?: SendMessageOptions & { fileParts?: FilePart[] },
    dedupeKey?: string,
    internal?: QueuedMessageInternalOptions
  )

Source from the content-addressed store, hash-verified

149 * Returns true if the message was queued.
150 */
151 addOnce(
152 message: string,
153 options?: SendMessageOptions & { fileParts?: FilePart[] },
154 dedupeKey?: string,
155 internal?: QueuedMessageInternalOptions
156 ): boolean {
157 if (dedupeKey !== undefined && this.dedupeKeys.has(dedupeKey)) {
158 return false;
159 }
160
161 const didAdd = this.addInternal(message, options, internal);
162 if (didAdd && dedupeKey !== undefined) {
163 this.dedupeKeys.add(dedupeKey);
164 }
165 return didAdd;
166 }
167
168 private addInternal(
169 message: string,

Callers 1

Calls 3

addInternalMethod · 0.95
addMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected