chore: add sleep log in `fetch_logs_with_cursor` (#4734)

### Description

<!--
What's included in this PR?
-->

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->
pull/4740/head
Daniel Savu 1 month ago committed by GitHub
parent 937392b61d
commit 5fc442b97f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      rust/main/config/mainnet_config.json
  2. 17
      rust/main/hyperlane-base/src/contract_sync/mod.rs
  3. 4
      rust/main/hyperlane-base/src/settings/parser/mod.rs

@ -784,7 +784,8 @@
"gasCurrencyCoinGeckoId": "ethereum", "gasCurrencyCoinGeckoId": "ethereum",
"index": { "index": {
"from": 1, "from": 1,
"mode": "sequence" "mode": "sequence",
"chunk": 100
}, },
"interchainGasPaymaster": "ABb3i11z7wKoGCfeRQNQbVYWjAm7jG7HzZnDLV4RKRbK", "interchainGasPaymaster": "ABb3i11z7wKoGCfeRQNQbVYWjAm7jG7HzZnDLV4RKRbK",
"mailbox": "EitxJuv2iBjsg2d7jVy2LDC1e2zBrx4GB5Y9h2Ko3A9Y", "mailbox": "EitxJuv2iBjsg2d7jVy2LDC1e2zBrx4GB5Y9h2Ko3A9Y",
@ -2804,7 +2805,8 @@
"gasCurrencyCoinGeckoId": "solana", "gasCurrencyCoinGeckoId": "solana",
"index": { "index": {
"from": 1, "from": 1,
"mode": "sequence" "mode": "sequence",
"chunk": 100
}, },
"interchainGasPaymaster": "JAvHW21tYXE9dtdG83DReqU2b4LUexFuCbtJT5tF8X6M", "interchainGasPaymaster": "JAvHW21tYXE9dtdG83DReqU2b4LUexFuCbtJT5tF8X6M",
"mailbox": "E588QtVUvresuXq2KoNEwAmoifCzYGpRBdHByN9KQMbi", "mailbox": "E588QtVUvresuXq2KoNEwAmoifCzYGpRBdHByN9KQMbi",

@ -170,7 +170,7 @@ where
Ok(logs) => logs, Ok(logs) => logs,
Err(err) => { Err(err) => {
warn!(?err, ?range, "Error fetching logs in range"); warn!(?err, ?range, "Error fetching logs in range");
break SLEEP_DURATION; break Some(SLEEP_DURATION);
} }
}; };
@ -196,13 +196,20 @@ where
// Update cursor // Update cursor
if let Err(err) = cursor.update(logs, range).await { if let Err(err) = cursor.update(logs, range).await {
warn!(?err, "Error updating cursor"); warn!(?err, "Error updating cursor");
break SLEEP_DURATION; break Some(SLEEP_DURATION);
}; };
break Default::default(); break None;
}, },
CursorAction::Sleep(duration) => duration, CursorAction::Sleep(duration) => Some(duration),
}; };
sleep(sleep_duration).await if let Some(sleep_duration) = sleep_duration {
debug!(
cursor = ?cursor,
?sleep_duration,
"Cursor can't make progress, sleeping",
);
sleep(sleep_duration).await
}
} }
async fn dedupe_and_store_logs( async fn dedupe_and_store_logs(

@ -34,6 +34,8 @@ pub use self::json_value_parser::ValueParser;
mod connection_parser; mod connection_parser;
mod json_value_parser; mod json_value_parser;
const DEFAULT_CHUNK_SIZE: u32 = 1999;
/// The base agent config /// The base agent config
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
#[serde(transparent)] #[serde(transparent)]
@ -152,7 +154,7 @@ fn parse_chain(
.get_opt_key("index") .get_opt_key("index")
.get_opt_key("chunk") .get_opt_key("chunk")
.parse_u32() .parse_u32()
.unwrap_or(1999); .unwrap_or(DEFAULT_CHUNK_SIZE);
let mode = chain let mode = chain
.chain(&mut err) .chain(&mut err)
.get_opt_key("index") .get_opt_key("index")

Loading…
Cancel
Save