Skip to main content
The quote-worker keeps the Redis quote cache fresh for any (oracleId, strike) the UI has marked hot (someone subscribed via WS or hit /v1/quotes/… in the last HOT_TTL_S, default 60s).

Loop

The diff check avoids spamming the WS channel with identical updates.

Hot set maintenance

  • WS sub to mark (oracle, strike) hot, set HOT_TTL_S expiry.
  • WS unsub to leave the TTL to expire; rapid re-sub avoids a re-quote round-trip.
  • REST GET /v1/quotes/:oracle/:strike cache miss to mark hot + immediate inline quote.
Non-hot strikes are quoted on demand by the api process when the cache misses.

File

packages/server/src/workers/quote-poller.ts.

Tuning

Higher polling rate to lower client-perceived latency but more RPC pressure. The 2s default is a good balance for a hackathon demo.