Skip to content

Commit

Permalink
chore: move tick to the top of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ppoliani committed Jan 29, 2024
1 parent e81e101 commit 4aa65fa
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 340 deletions.
4 changes: 3 additions & 1 deletion src/address_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,20 @@ impl AddressVerifier {
let mut interval = interval(Duration::from_secs(600));

loop {
interval.tick().await;

let Ok(publish_date) = Self::publish_date().await else {
error!("couldn't extract the OFAC document publish date");
continue;
};

info!("{:?}", *last_update.read().await);
if *last_update.read().await >= publish_date {
info!("OFAC list is up-to-date");
continue;
}

let mut sanctioned_addresses = sanctioned_addresses.write().await;
interval.tick().await;

let mut last_update = last_update.write().await;
*last_update = publish_date;
Expand Down
Loading

0 comments on commit 4aa65fa

Please sign in to comment.