( promise: Promise<T>, timeoutMs: number, operation = 'Operation' )
| 144 | } |
| 145 | |
| 146 | function withTimeout<T>( |
| 147 | promise: Promise<T>, |
| 148 | timeoutMs: number, |
| 149 | operation = 'Operation' |
| 150 | ): Promise<T> { |
| 151 | return Promise.race([ |
| 152 | promise, |
| 153 | new Promise<never>((_, reject) => |
| 154 | setTimeout(() => reject(new Error(`${operation} timed out after ${timeoutMs}ms`)), timeoutMs) |
| 155 | ), |
| 156 | ]) |
| 157 | } |
| 158 | |
| 159 | const PROCESSING_CONFIG = { |
| 160 | maxConcurrentDocuments: |
no outgoing calls
no test coverage detected