fix(relay): defer on inventory probe errors; optional retry without budget

- MessageQueue: resetRetryCount and retry({ increment: false }) for shedder/inventory paths
- RelayService: treat bridge_inventory_probe like other soft-failure scopes; wrap inventory check in try/catch
- Token aggregation: catch DB pool lookup errors and fall back to live DODO path
- Mainnet WETH profile: START_BLOCK=latest; extend RELAY_SKIP_MESSAGE_IDS for backlog hygiene
- Extend relay test.js for deferred requeue behavior

Made-with: Cursor
This commit is contained in:
defiQUG
2026-04-12 11:35:18 -07:00
parent 06c4bebcb7
commit 8ec6af94d5
5 changed files with 67 additions and 22 deletions

View File

@@ -65,14 +65,22 @@ export class MessageQueue {
async getRetryCount(messageId) {
return this.retryCounts.get(messageId) || 0;
}
async resetRetryCount(messageId) {
this.retryCounts.delete(messageId);
}
async retry(messageId) {
async retry(messageId, options = {}) {
const { increment = true } = options;
const count = this.retryCounts.get(messageId) || 0;
this.retryCounts.set(messageId, count + 1);
if (increment) {
this.retryCounts.set(messageId, count + 1);
}
const existingIndex = this.queue.findIndex(m => m.messageId === messageId);
if (existingIndex >= 0) {
this.logger.info(`Message ${messageId} retry count: ${count + 1}`);
const nextCount = increment ? count + 1 : count;
this.logger.info(`Message ${messageId} retry count: ${nextCount}`);
return;
}
@@ -84,7 +92,8 @@ export class MessageQueue {
this.inFlight.delete(messageId);
this.queue.push(messageData);
this.logger.info(`Message ${messageId} requeued. Retry count: ${count + 1}. Queue size: ${this.queue.length}`);
const nextCount = increment ? count + 1 : count;
this.logger.info(`Message ${messageId} requeued. Retry count: ${nextCount}. Queue size: ${this.queue.length}`);
}
getStats() {