ENGINEERING NOTE 03 / 50 · SMS
Poll SMS orders without creating a request storm
Polling needs a deadline, a request budget and a terminal stop condition. An interval alone does not prevent an abandoned browser from polling forever.
Published by OPEN RAMBO. The engineering patterns and pseudocode illustrate designs, not a documented product API. Numerical examples are illustrative.
Give one order one poller
Navigation and component remounts can create several timers for the same order. Cancel the previous timer before creating another. Wait for the current request to finish before scheduling the next so a slow response cannot stack overlapping requests.
Use the server expiry
Compute the remaining window from the server’s order expiry and a measured server-time offset. Stop on receipt, confirmed cancellation or expiry. A hidden tab may poll less frequently, but must perform a fresh read when visible again rather than assuming its stale label is final.
Handle overload deliberately
Respect a documented retry delay and apply jitter across clients. Authentication failure should stop polling and request sign-in, not trigger a retry loop. Keep timeout errors distinct from an order-expired response; one describes transport and the other describes the order.
Illustrative implementation
while now() < expires_at and requests < budget:
state = await read_order(order_id)
if state in TERMINAL: break
await sleep(next_delay_with_jitter())
requests += 1Acceptance check
Use a fake clock to test tab hiding, remounts, slow requests and expiry. Assert a bounded total request count.