Commit Graph

7 Commits

Author SHA1 Message Date
Thomas Eizinger
9ad2160c69
Refactor the kraken module to automatically re-connect on errors
In order to be able to re-connect on certain errors, we model
connection errors separately from parsing errors. We also change
the API of the whole module to no longer forward all errors to
the subscribers but instead, only update the subscribers with
either a latest rate or a permanent failure in case we exhausted
all our options to re-connect the websocket.

To model all of this properly, we introduce to sub-modules so that
each submodule can have their own `Error` type.

Resolves #297.
2021-03-09 17:37:37 +11:00
Thomas Eizinger
c560b3b21a
Introduce RateUpdate type alias to reduce duplication 2021-03-09 15:39:08 +11:00
Thomas Eizinger
fd5b38739a
Remove constant in favor of inlining string
This removes an import and simplifies the `connect_async` call.
2021-03-09 15:39:07 +11:00
Thomas Eizinger
142e5e2d3a
Use tracing macros by fully-qualifying them 2021-03-09 15:39:03 +11:00
Thomas Eizinger
1822886cd0
Provide stronger isolation of kraken module
Instead of leaking the tokio::sync::Receiver type in our
return value, we create a newtype that implements the desired
interface. This allows us to get rid of the `RateService` structs
and instead implement `LatestRate` directly on top of this struct.

Given that `LatestRate` is only used within the event_loop module,
we move the definition of this type into there.
2021-03-05 13:56:25 +11:00
Thomas Eizinger
f6ed4d65b5
Properly deal with additional messages sent from kraken 2021-03-05 13:40:39 +11:00
Thomas Eizinger
60d6d50246
Extract kraken websocket client into dedicated module 2021-03-05 13:37:51 +11:00