Commit 3142128
committed
fix: preserve subscription casing on duplicate cache key to prevent feed death
When two requests share the same normalised cache key but differ in casing
(e.g. USDe/USD and usde/usd), ExpiringSortedSet.add() was overwriting the
stored params with the new casing. This caused StreamingTransport's
JSON.stringify diff to see a spurious change on the next background execute,
triggering an unnecessary unsubscribe then resubscribe. Because sendMessages
sends subscribes before unsubscribes, a case-insensitive provider would start
the feed then immediately kill it — and because localSubscriptions was then set
to desiredSubs, no diff would fire again, leaving the feed permanently dead and
both request variants returning 504 after cache expiry.
Fix: when a key already exists in ExpiringSortedSet, only refresh the TTL and
keep the original value (first-writer-wins). Emit a warning when the incoming
value differs from the stored one, as this indicates inconsistent request casing
that may cause issues with case-sensitive providers.1 parent 69f5609 commit 3142128
1 file changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
36 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
37 | 52 | | |
38 | 53 | | |
39 | 54 | | |
| |||
0 commit comments