@riocrypto/common-server 1.0.2917 → 1.0.2918
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/build/models/order.js +7 -0
- package/package.json +1 -1
package/build/models/order.js
CHANGED
|
@@ -403,6 +403,13 @@ const buildOrder = (mongoose) => {
|
|
|
403
403
|
orderSchema.index({ payoutAutoRetryAt: 1 }, { sparse: true });
|
|
404
404
|
orderSchema.index({ userId: 1, "TWAP.sessionId": 1, createdAt: 1 });
|
|
405
405
|
orderSchema.index({ brokerId: 1, "TWAP.sessionId": 1, createdAt: 1 });
|
|
406
|
+
// The stuck order scans (the admin task in admin-tasks and the payout
|
|
407
|
+
// auto-complete in orders) both select on status alone, which no index above
|
|
408
|
+
// has as a prefix, so each run scanned the whole collection. The first serves
|
|
409
|
+
// the side + status pairs the auto-complete looks for, the second gives the
|
|
410
|
+
// admin task its createdAt bound after the status bounds.
|
|
411
|
+
orderSchema.index({ status: 1, side: 1 });
|
|
412
|
+
orderSchema.index({ status: 1, createdAt: 1 });
|
|
406
413
|
orderSchema.index({ clientReferenceId: 1 }, { sparse: true });
|
|
407
414
|
orderSchema.index({ "paymentsReceived.blockchainTxId": 1 }, { sparse: true });
|
|
408
415
|
// At most one order per real quoteId. Imported orders use quoteId "" and are
|