MCPcopy
hub / github.com/codeaashu/claude-code / dequeueAllMatching

Function dequeueAllMatching

src/utils/messageQueueManager.ts:244–266  ·  view source on GitHub ↗
(
  predicate: (cmd: QueuedCommand) => boolean,
)

Source from the content-addressed store, hash-verified

242 * Non-matching commands stay in the queue.
243 */
244export function dequeueAllMatching(
245 predicate: (cmd: QueuedCommand) => boolean,
246): QueuedCommand[] {
247 const matched: QueuedCommand[] = []
248 const remaining: QueuedCommand[] = []
249 for (const cmd of commandQueue) {
250 if (predicate(cmd)) {
251 matched.push(cmd)
252 } else {
253 remaining.push(cmd)
254 }
255 }
256 if (matched.length === 0) {
257 return []
258 }
259 commandQueue.length = 0
260 commandQueue.push(...remaining)
261 notifySubscribers()
262 for (const _cmd of matched) {
263 logOperation('dequeue')
264 }
265 return matched
266}
267
268/**
269 * Remove specific commands from the queue by reference identity.

Callers 3

processQueueIfReadyFunction · 0.85
runHeadlessStreamingFunction · 0.85
killShellTasksForAgentFunction · 0.85

Calls 3

notifySubscribersFunction · 0.85
logOperationFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected