-
Notifications
You must be signed in to change notification settings - Fork 308
fix(hermes): handle price feed removal properly #1166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
hermes/src/api/ws.rs
Outdated
| // close the connection. | ||
| self.sender | ||
| .send( | ||
| serde_json::to_string(&ServerResponseMessage::Err { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just ignore the removed feeds? In the current solution, when a price feed is removed, all websocket connections need to be opened up again and we will miss a few slots in between.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's a fair point and I have changed the code to follow what you says. However I think it is an unintuitive business logic and might surprise consumers. I wouldn't do it if our data ingestion wasn't relying on this.
The better approach would be what you had suggested before, a subscribeToAll method (or a *) and it is intuitive for a subscription to all to keep the connection while a feed is removed. However I didn't do it because it is a big change and we are going to move away from this API soon.
|
|
||
| for key in keys_in_cache { | ||
| if !current_keys.contains(&key) { | ||
| message_cache.remove(&key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not very often, it would be great if we add some log here to see it in action once live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a info log level for it.
056c4f2 to
988e112
Compare
988e112 to
5c85f97
Compare
No description provided.