Skip to main content

Bifrost: Disable Periodic Auto-Recovery

PR: https://github.com/ForSyt-io/Hannibal/pull/143 Branch: fix/disable-bifrost-auto-recovery (from fix/bifrost-market-fixes) Deployed to: bhdev (via feat/bhdev) Date: 2026-03-02

Context

Michael (Bifrost team) confirmed RabbitMQ stream delivers everything continuously — events, catalogues, market books. Periodic recovery was NOT needed during normal operation and was flooding ~12,000 messages every 10 minutes.

Changes Made

1. BifrostRecoveryManager.ts

  • Removed: 10-minute setInterval for recoverEvents('periodic')
  • Kept: Startup recovery (trigger === 'initial') — needed for cold start / reconnect
  • Kept: 30s phantom linker — local cache operation, no API calls
  • Added: triggerManualRecovery(triggeredBy) public method
  • Changed: All recovery triggers now include includeMarketBook: true (since periodic is gone, every recovery is a full snapshot)

2. BifrostAdapter.ts

  • Added: getRecoveryManager() accessor for admin endpoint
  • Added: Market validity rule in buildMarketsForEvent()if (!book) continue; skips catalogue-only markets

3. admin.ts

  • Added: POST /api/admin/bifrost/recover endpoint (admin/super_admin auth)
  • Runs recovery in background (non-blocking HTTP response)
  • Logs triggeredBy (admin email) and timestamp

What Was NOT Changed

  • All recovery code is intact — just not triggered automatically
  • Startup recovery still runs on every server start
  • Phantom linker still runs every 30s
  • No frontend changes
  • No database changes

Verification Checklist

  • bhdev Docker logs show NO [BifrostRecovery] periodic events recovery after startup
  • Startup recovery log [BifrostRecovery] initial events recovery appears once
  • Phantom linker logs appear every 30s
  • POST /api/admin/bifrost/recover returns 200 with success message
  • Markets without books are excluded from getOdds API response
  • Michael's pre-check tests pass