mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
Compare commits
2 Commits
e2bdc69556
...
8b90b2d4a9
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b90b2d4a9 | |||
| a8df1fdaeb |
@ -231,11 +231,6 @@ fn read_last_complete_line<R: Read + Seek>(read: &mut R) -> Option<(BlockAndRece
|
|||||||
pos -= read_size;
|
pos -= read_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
println!(
|
|
||||||
"last_line: {:?} {:?}",
|
|
||||||
String::from_utf8(last_line.clone()).unwrap(),
|
|
||||||
line_to_evm_block(&String::from_utf8(last_line.clone()).unwrap())
|
|
||||||
);
|
|
||||||
line_to_evm_block(&String::from_utf8(last_line).unwrap()).ok()
|
line_to_evm_block(&String::from_utf8(last_line).unwrap()).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,8 +239,9 @@ impl HlNodeBlockSource {
|
|||||||
/// But if we immediately fallback to s3/ingest-dir, in case of S3, it may cause unnecessary
|
/// But if we immediately fallback to s3/ingest-dir, in case of S3, it may cause unnecessary
|
||||||
/// requests to S3 while it'll return 404.
|
/// requests to S3 while it'll return 404.
|
||||||
///
|
///
|
||||||
/// So we allow a small threshold to avoid unnecessary fallback.
|
/// To avoid unnecessary fallback, we set a short threshold period.
|
||||||
pub(crate) const MAX_ALLOWED_THRESHOLD_BEFORE_FALLBACK: Duration = Duration::milliseconds(500);
|
/// This threshold is several times longer than the expected block time, reducing redundant fallback attempts.
|
||||||
|
pub(crate) const MAX_ALLOWED_THRESHOLD_BEFORE_FALLBACK: Duration = Duration::milliseconds(5000);
|
||||||
|
|
||||||
async fn update_last_fetch(&self, height: u64, now: OffsetDateTime) {
|
async fn update_last_fetch(&self, height: u64, now: OffsetDateTime) {
|
||||||
if let Some((last_height, _)) = *self.last_local_fetch.lock().await {
|
if let Some((last_height, _)) = *self.last_local_fetch.lock().await {
|
||||||
@ -314,8 +310,6 @@ impl HlNodeBlockSource {
|
|||||||
let mut u_cache = cache.lock().await;
|
let mut u_cache = cache.lock().await;
|
||||||
|
|
||||||
for subfile in Self::all_hourly_files(root).unwrap_or_default() {
|
for subfile in Self::all_hourly_files(root).unwrap_or_default() {
|
||||||
let mut file = File::open(&subfile).expect("Failed to open hour file path");
|
|
||||||
println!("subfile: {:?} {:?}", subfile, read_last_complete_line(&mut file));
|
|
||||||
let mut file = File::open(&subfile).expect("Failed to open hour file path");
|
let mut file = File::open(&subfile).expect("Failed to open hour file path");
|
||||||
if let Some((_, height)) = read_last_complete_line(&mut file) {
|
if let Some((_, height)) = read_last_complete_line(&mut file) {
|
||||||
if height < cutoff_height {
|
if height < cutoff_height {
|
||||||
|
|||||||
Reference in New Issue
Block a user