Refactor threads to use trait implementations

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-02-05 13:47:43 +00:00
parent a796feb299
commit 85eef2bf0b
9 changed files with 524 additions and 439 deletions

View File

@@ -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();
}
}