Commit Graph

13 Commits (620ac569f7db4b19c3dc761619e7a4d0ab0841dd)

Author SHA1 Message Date
Philipp Hoenisch 316f95c65b
Always log whole causality chain for errors. 3 years ago
Philipp Hoenisch c011e95062
Improve logging by adding details as fields instead of into the msg. 3 years ago
Thomas Eizinger 654cfff2a8
Make `kraken` module emit `PriceUpdate`s instead of `Rate`s 4 years ago
Thomas Eizinger cfc530e8ab
Make `ask` field of `Rate` private 4 years ago
Thomas Eizinger bc46d95985
Remove unnecessary `Serialize` implementations 4 years ago
Thomas Eizinger bac0f11898
Disable `backoff`s `max_elapsed_time` functionality
This config setting makes backoff stop retrying if we didn't get an
error within this timeframe.
For us, this results in backoff not actually doing anything.

The connection to kraken is very long-running. It might be active
for hours without failing. However, the default value for
`max_elapsed_time` is set to 15 minutes. As such, once the connection
fails any time after that, backoff doesn't actually retry the operation
but just gives up.

Fixes #303.
4 years ago
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.
4 years ago
Thomas Eizinger c560b3b21a
Introduce `RateUpdate` type alias to reduce duplication 4 years ago
Thomas Eizinger fd5b38739a
Remove constant in favor of inlining string
This removes an import and simplifies the `connect_async` call.
4 years ago
Thomas Eizinger 142e5e2d3a
Use tracing macros by fully-qualifying them 4 years ago
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.
4 years ago
Thomas Eizinger f6ed4d65b5
Properly deal with additional messages sent from kraken 4 years ago
Thomas Eizinger 60d6d50246
Extract kraken websocket client into dedicated module 4 years ago