Feat/OPDATA-6934 nobi ea#5020
Conversation
🦋 Changeset detectedLatest commit: dc1a2c5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| - `MAX_TRANSPORTS`: The maximum number of WebSocket transports to manage. Default is 10. | ||
| - `MAX_SUBSCRIPTIONS_PER_TRANSPORT`: The maximum number of currency pairs to route through a single transport before routing to the next one. Default is 100. |
There was a problem hiding this comment.
Why are these not in packages/sources/nobi/src/config/index.ts
There was a problem hiding this comment.
I think they could be, but then we'd have to lazy load the transport manager as a singleton
alejoberardino
left a comment
There was a problem hiding this comment.
PR with suggested approach: #5021
| }, | ||
| }, | ||
| builders: { | ||
| // Nobi's WS API requires sending the full list of pairs to subscribe, keep track of activePairs |
| requestCount: number | ||
| } | ||
|
|
||
| export class NobiTransportManager { |
There was a problem hiding this comment.
I get why but it's way too much imo, I don't believe having this be configurable is a good thing. I'd still loop and make 10 transports (the documented max connections) and have max subs as a proper config (which you could since the only place we'd need it is in the customRouter I think)
If we do see this as a repeated pattern (haven't so far afaik) and want to build some more complex abstracted logic we should put this in the fw
Closes #OPDATA-6934
Description
Adds Nobi state price EA
Changes
src/endpoint/transportManagerthat controls request routing based on a max number of WS subscriptions per connection and max number of connections per key (see ticket for details)Steps to Test
yarn test nobi{ "data": { "endpoint": "price", "base": "BTC", "quote": "USD" } }Set
MAX_SUBSCRIPTIONS_PER_TRANSPORTsufficiently low (eg: 2) and request other common crypto pairs (eg: ETH/USD, SOL/USD) to see transport rolloverQuality Assurance
infra-k8sconfiguration file.adapter-secretsconfiguration file.test-payload.jsonfile with relevant requests.feature/x,chore/x,release/x,hotfix/x,fix/x) or is created from Jira.