bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.19k stars 679 forks source link

Fix race condition when resetting feeds with multiple connections #851

Closed agijsberts closed 2 years ago

agijsberts commented 2 years ago

Description of code - what bug does this fix / what feature does this add?

This PR solves https://github.com/bmoscon/cryptofeed/issues/848. It solves the issue in all exchanges where I could replicate the bug.

Though this PR resolves the issue, I think it would be much better to do `connection-dependent'' resetting in all exchanges by implementing a shared_reset(self, conn: AsyncConnection)method in theFeed` base class and overload it when necessary in the derived classes. Since this change would affect all exchanges, I'd first like to know whether there is a shared interest for this refactoring.

In addition, while solving the original issue I came across two issues: