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

This commit is contained in:
Christian Kamm 2023-11-24 11:04:59 +01:00 committed by GitHub
parent 9a68a2dd7d
commit 0483faef1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -519,11 +519,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;
}
@ -532,10 +532,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 {