correct loop (not ignoring first tick). grouped together managers update

This commit is contained in:
Giulio De Pasquale 2021-01-14 12:46:35 +00:00
parent c87da2bb6a
commit 23c2d58647

View File

@ -62,16 +62,26 @@ impl BfxBot {
}
pub async fn start_loop(&mut self) -> Result<(), BoxError> {
self.update_managers().await?;
loop {
self.update().await;
}
}
async fn update(&mut self) {
async fn update(&mut self) -> Result<(), BoxError> {
delay_for(self.ticker.duration()).await;
self.ticker.inc();
self.update_price_managers().await.unwrap();
self.update_managers().await?;
Ok(())
}
async fn update_managers(&mut self) -> Result<(), BoxError> {
self.update_price_managers().await?;
Ok(())
}
async fn update_price_managers(&mut self) -> Result<Option<Vec<Event>>, BoxError> {