(opts)
| 234 | let _orderQueue = Promise.resolve(); |
| 235 | |
| 236 | function considerOrder(opts) { |
| 237 | if (!_started) return Promise.resolve({ ok: false, skipped: true, reason: 'not_started' }); |
| 238 | if (!opts || !Array.isArray(opts.capabilities) || opts.capabilities.length === 0) { |
| 239 | return Promise.resolve({ ok: false, skipped: true, reason: 'no_capabilities' }); |
| 240 | } |
| 241 | const next = _orderQueue.then( |
| 242 | () => _considerOrderSerialized(opts), |
| 243 | () => _considerOrderSerialized(opts), // never let a prior rejection break the chain |
| 244 | ); |
| 245 | // Swallow rejection on the queue tail so a single thrown error here does |
| 246 | // not poison every subsequent call; the original `next` promise still |
| 247 | // surfaces the error to the caller. |
| 248 | _orderQueue = next.then(() => {}, () => {}); |
| 249 | return next; |
| 250 | } |
| 251 | |
| 252 | async function _considerOrderSerialized(opts) { |
| 253 | const now = Date.now(); |
nothing calls this directly
no test coverage detected