liquidator: fix token info for same-name, fix delays (#795)
(cherry picked from commit 0483faef1e
)
This commit is contained in:
parent
2551fd7e34
commit
5cfbb8386d
|
@ -499,11 +499,11 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let token_swap_info_job = tokio::spawn({
|
let token_swap_info_job = tokio::spawn({
|
||||||
// TODO: configurable interval
|
// TODO: configurable interval
|
||||||
let mut interval = tokio::time::interval(Duration::from_secs(60));
|
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();
|
let shared_state = shared_state.clone();
|
||||||
async move {
|
async move {
|
||||||
loop {
|
loop {
|
||||||
min_delay.tick().await;
|
startup_wait.tick().await;
|
||||||
if !shared_state.read().unwrap().one_snapshot_done {
|
if !shared_state.read().unwrap().one_snapshot_done {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -512,10 +512,11 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let token_indexes = token_swap_info_updater
|
let token_indexes = token_swap_info_updater
|
||||||
.mango_client()
|
.mango_client()
|
||||||
.context
|
.context
|
||||||
.token_indexes_by_name
|
.tokens
|
||||||
.values()
|
.keys()
|
||||||
.copied()
|
.copied()
|
||||||
.collect_vec();
|
.collect_vec();
|
||||||
|
let mut min_delay = tokio::time::interval(Duration::from_secs(1));
|
||||||
for token_index in token_indexes {
|
for token_index in token_indexes {
|
||||||
min_delay.tick().await;
|
min_delay.tick().await;
|
||||||
match token_swap_info_updater.update_one(token_index).await {
|
match token_swap_info_updater.update_one(token_index).await {
|
||||||
|
|
Loading…
Reference in New Issue