liquidator: fix token info for same-name, fix delays (#795)

(cherry picked from commit 0483faef1e)
This commit is contained in:
Christian Kamm 2023-11-24 11:04:59 +01:00
parent 2551fd7e34
commit 5cfbb8386d
1 changed files with 5 additions and 4 deletions

View File

@ -499,11 +499,11 @@ async fn main() -> anyhow::Result<()> {
let token_swap_info_job = tokio::spawn({
// TODO: configurable interval
let mut interval = tokio::time::interval(Duration::from_secs(60));
let mut min_delay = tokio::time::interval(Duration::from_secs(1));
let mut startup_wait = tokio::time::interval(Duration::from_secs(1));
let shared_state = shared_state.clone();
async move {
loop {
min_delay.tick().await;
startup_wait.tick().await;
if !shared_state.read().unwrap().one_snapshot_done {
continue;
}
@ -512,10 +512,11 @@ async fn main() -> anyhow::Result<()> {
let token_indexes = token_swap_info_updater
.mango_client()
.context
.token_indexes_by_name
.values()
.tokens
.keys()
.copied()
.collect_vec();
let mut min_delay = tokio::time::interval(Duration::from_secs(1));
for token_index in token_indexes {
min_delay.tick().await;
match token_swap_info_updater.update_one(token_index).await {