akemon 0.1.59 → 0.1.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +11 -9
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1342,6 +1342,17 @@ async function startOrderLoop(options) {
|
|
|
1342
1342
|
for (const order of orders) {
|
|
1343
1343
|
if (gaveUp.has(order.id))
|
|
1344
1344
|
continue;
|
|
1345
|
+
// Check retry timing
|
|
1346
|
+
const retry = retryState.get(order.id);
|
|
1347
|
+
if (retry && Date.now() < retry.nextAt)
|
|
1348
|
+
continue;
|
|
1349
|
+
// Skip everything if engine is busy — don't accept new orders either
|
|
1350
|
+
if (engineBusy) {
|
|
1351
|
+
if (order.status === "processing") {
|
|
1352
|
+
console.log(`[orders] Engine busy, skipping order ${order.id}`);
|
|
1353
|
+
}
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1345
1356
|
if (order.status === "pending") {
|
|
1346
1357
|
// Accept the order (escrows buyer credits)
|
|
1347
1358
|
const acceptRes = await fetch(`${relayHttp}/v1/orders/${order.id}/accept`, {
|
|
@@ -1354,15 +1365,6 @@ async function startOrderLoop(options) {
|
|
|
1354
1365
|
}
|
|
1355
1366
|
console.log(`[orders] Accepted order ${order.id}`);
|
|
1356
1367
|
}
|
|
1357
|
-
// Check retry timing
|
|
1358
|
-
const retry = retryState.get(order.id);
|
|
1359
|
-
if (retry && Date.now() < retry.nextAt)
|
|
1360
|
-
continue;
|
|
1361
|
-
// Skip if engine is busy
|
|
1362
|
-
if (engineBusy) {
|
|
1363
|
-
console.log(`[orders] Engine busy, skipping order ${order.id}`);
|
|
1364
|
-
continue;
|
|
1365
|
-
}
|
|
1366
1368
|
// Attempt to fulfill the order
|
|
1367
1369
|
engineBusy = true;
|
|
1368
1370
|
engineBusySince = Date.now();
|