From b60a5e1a0845bda4972e9f89a0ab2054a2a076eb Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 29 Dec 2024 15:00:12 +0100 Subject: [PATCH] fix: time between updates from nearblocks (#10) --- Cargo.lock | 7 +++---- Cargo.toml | 2 +- src/entrypoints/proposal/mod.rs | 4 ++-- src/entrypoints/rfp/mod.rs | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4db3dd..1500b71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2201,14 +2201,14 @@ dependencies = [ [[package]] name = "near-api" -version = "0.2.1" -source = "git+https://github.com/near/near-api-rs#cd99c1ab74f2dbdc9ed785af7578f3609ea02c33" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a97c776b376cf7712e5e8942c0bf729baf05e939505ed33021f82e6b3e6baad" dependencies = [ "async-trait", "bip39", "borsh", "bs58 0.4.0", - "derive_more", "ed25519-dalek", "futures", "keyring", @@ -2227,7 +2227,6 @@ dependencies = [ "reqwest", "serde", "serde_json", - "serde_with", "slipped10", "thiserror 1.0.69", "tokio", diff --git a/Cargo.toml b/Cargo.toml index edb308e..783fc27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ anyhow = "1.0.76" rocket_cors = "0.6.0" utoipa-swagger-ui = { version = "7.1", features = ["rocket"] } reqwest = "0.12.8" -near-api = { git = "https://github.com/near/near-api-rs" } +near-api = "0.3.0" near-jsonrpc-client = "0.14.0" regex = "1.11.1" base64 = "0.22.1" diff --git a/src/entrypoints/proposal/mod.rs b/src/entrypoints/proposal/mod.rs index 34e0cb2..b817780 100644 --- a/src/entrypoints/proposal/mod.rs +++ b/src/entrypoints/proposal/mod.rs @@ -94,7 +94,7 @@ async fn get_proposals( let last_updated_info = db.get_last_updated_info().await.unwrap(); if current_timestamp_nano - last_updated_info.after_date - >= chrono::Duration::seconds(60).num_nanoseconds().unwrap() + >= chrono::Duration::seconds(1).num_nanoseconds().unwrap() { update_nearblocks_data( db.inner(), @@ -127,7 +127,7 @@ async fn get_proposal_with_all_snapshots( let last_updated_info = db.get_last_updated_info().await.unwrap(); if current_timestamp_nano - last_updated_info.after_date - >= chrono::Duration::seconds(60).num_nanoseconds().unwrap() + >= chrono::Duration::seconds(1).num_nanoseconds().unwrap() { update_nearblocks_data( db.inner(), diff --git a/src/entrypoints/rfp/mod.rs b/src/entrypoints/rfp/mod.rs index 9e89bf4..4e58978 100644 --- a/src/entrypoints/rfp/mod.rs +++ b/src/entrypoints/rfp/mod.rs @@ -90,7 +90,7 @@ async fn get_rfps( let last_updated_info = db.get_last_updated_info().await.unwrap(); if current_timestamp_nano - last_updated_info.after_date - >= chrono::Duration::seconds(60).num_nanoseconds().unwrap() + >= chrono::Duration::seconds(1).num_nanoseconds().unwrap() { update_nearblocks_data( db.inner(), @@ -135,7 +135,7 @@ async fn get_rfp_with_snapshots( let last_updated_info = db.get_last_updated_info().await.unwrap(); if current_timestamp_nano - last_updated_info.after_date - >= chrono::Duration::seconds(60).num_nanoseconds().unwrap() + >= chrono::Duration::seconds(1).num_nanoseconds().unwrap() { update_nearblocks_data( db.inner(),