( locks: Map<string, Promise<unknown>>, keys: RequestExecutionLockKey[], task: () => Promise<T>, )
| 153 | } |
| 154 | |
| 155 | async function withRequestExecutionLocks<T>( |
| 156 | locks: Map<string, Promise<unknown>>, |
| 157 | keys: RequestExecutionLockKey[], |
| 158 | task: () => Promise<T>, |
| 159 | ): Promise<T> { |
| 160 | const [key, ...remainingKeys] = keys; |
| 161 | if (!key) return await task(); |
| 162 | return await withKeyedLock( |
| 163 | locks, |
| 164 | key, |
| 165 | async () => await withRequestExecutionLocks(locks, remainingKeys, task), |
| 166 | ); |
| 167 | } |
| 168 | |
| 169 | function applyRequestCommandDefaults(req: DaemonRequest): DaemonRequest { |
| 170 | const flags = { ...(req.flags ?? {}) }; |
no test coverage detected