Method
withQueueLock
(fn: () => Promise<T> | T)
Source from the content-addressed store, hash-verified
| 252 | } |
| 253 | |
| 254 | private async withQueueLock<T>(fn: () => Promise<T> | T): Promise<T> { |
| 255 | const prevLock = this.queueLock |
| 256 | let resolveLock: () => void |
| 257 | this.queueLock = new Promise((resolve) => { |
| 258 | resolveLock = resolve |
| 259 | }) |
| 260 | await prevLock |
| 261 | try { |
| 262 | return await fn() |
| 263 | } finally { |
| 264 | resolveLock!() |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | private initializeQueue(triggerBlockId?: string): void { |
| 269 | if (this.context.runFromBlockContext) { |
Tested by
no test coverage detected