correct loop (not ignoring first tick). grouped together managers update
This commit is contained in:
parent
c87da2bb6a
commit
23c2d58647
@ -62,16 +62,26 @@ impl BfxBot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn start_loop(&mut self) -> Result<(), BoxError> {
|
pub async fn start_loop(&mut self) -> Result<(), BoxError> {
|
||||||
|
self.update_managers().await?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
self.update().await;
|
self.update().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update(&mut self) {
|
async fn update(&mut self) -> Result<(), BoxError> {
|
||||||
delay_for(self.ticker.duration()).await;
|
delay_for(self.ticker.duration()).await;
|
||||||
self.ticker.inc();
|
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> {
|
async fn update_price_managers(&mut self) -> Result<Option<Vec<Event>>, BoxError> {
|
||||||
|
Loading…
Reference in New Issue
Block a user