MCPcopy Create free account
hub / github.com/EvoMap/evolver / considerOrder

Function considerOrder

src/atp/autoBuyer.js:236–250  ·  view source on GitHub ↗
(opts)

Source from the content-addressed store, hash-verified

234let _orderQueue = Promise.resolve();
235
236function 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
252async function _considerOrderSerialized(opts) {
253 const now = Date.now();

Callers

nothing calls this directly

Calls 1

_considerOrderSerializedFunction · 0.85

Tested by

no test coverage detected