* Push a message immediately without batching delay. * Does not clear the queue or enforce isolation.
(message: string, mode: T, localId?: string)
| 76 | * Does not clear the queue or enforce isolation. |
| 77 | */ |
| 78 | pushImmediate(message: string, mode: T, localId?: string): void { |
| 79 | if (this.closed) { |
| 80 | throw new Error('Cannot push to closed queue'); |
| 81 | } |
| 82 | |
| 83 | const modeHash = this.modeHasher(mode); |
| 84 | logger.debug(`[MessageQueue2] pushImmediate() called with mode hash: ${modeHash}`); |
| 85 | |
| 86 | this.queue.push({ |
| 87 | message, |
| 88 | mode, |
| 89 | modeHash, |
| 90 | localId, |
| 91 | isolate: false |
| 92 | }); |
| 93 | |
| 94 | // Trigger message handler if set |
| 95 | if (this.onMessageHandler) { |
| 96 | this.onMessageHandler(message, mode); |
| 97 | } |
| 98 | |
| 99 | // Notify waiter if any |
| 100 | if (this.waiter) { |
| 101 | logger.debug(`[MessageQueue2] Notifying waiter for immediate message`); |
| 102 | const waiter = this.waiter; |
| 103 | this.waiter = null; |
| 104 | waiter(true); |
| 105 | } |
| 106 | |
| 107 | logger.debug(`[MessageQueue2] pushImmediate() completed. Queue size: ${this.queue.length}`); |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Push a message that must be processed in isolation, preserving any |
no test coverage detected