Refactor Pyth Lazer to run one bulk subscription per channel - #167
Conversation
d5bd208 to
e02a02d
Compare
Great find! Sounds like a nice improvement over the current behaviour that simply times out after 3 seconds :) |
Thomasvdam
left a comment
There was a problem hiding this comment.
Obviously I think this is cleaner, but I hope it's more than just personal preference 😂
Just a few small nitpicks, the flow looks great and the docs nicely outline how the design works and the tradeoffs/limitations in the current implementation.
Maybe in a future cleanup it's worth splitting some of the logic into Effect services to make testing a little easier, but lets not get into that now. :)
e02a02d to
1f5201e
Compare
I suppose we could add an LRU cache of certain capacity, but now I am no longer sure about returning 400 to requests containing IDs that have been returned as unknown from Pyth. I thought Pyth recommends
Ah good point, well noted!! |
A numeric token that is not u32 makes the client WebSocket pool return an invalid value error, which then blocks all future subscriptions.
7b5d01d to
3584526
Compare
Newer Bun coerces env writes to strings.
4fe33ca to
baf22f0
Compare
baf22f0 to
90c77da
Compare
Without a pre-configured feed, the module repeats a cycle of successful connection followed by 5-second timeout indefinitely. If no feed is provided in the config, a default one is used for backward compatibility.
90c77da to
82d3367
Compare
Motivation
Alternative approach to #165 in order to reduce number of incoming messages (frames). Cleaner approach thanks to @Thomasvdam
Explanation of Changes
We now keep at most one subscription per channel.
subscriptionsmap) "grows" or gains any new IDs.Testing
Added unit tests and tested locally
Related PRs and Issues
Alternative to #165