Refactor threads to use trait implementations
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -35,7 +35,7 @@ impl From<alpaca::api::incoming::clock::Clock> for Message {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn run(app_config: Arc<Config>, clock_sender: mpsc::Sender<Message>) {
|
||||
pub async fn run(app_config: Arc<Config>, sender: mpsc::Sender<Message>) {
|
||||
loop {
|
||||
let clock = retry(ExponentialBackoff::default(), || async {
|
||||
app_config.alpaca_rate_limit.until_ready().await;
|
||||
@@ -61,6 +61,6 @@ pub async fn run(app_config: Arc<Config>, clock_sender: mpsc::Sender<Message>) {
|
||||
});
|
||||
|
||||
sleep(sleep_until).await;
|
||||
clock_sender.send(clock.into()).await.unwrap();
|
||||
sender.send(clock.into()).await.unwrap();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user