Skip to content

Commit c507623

Browse files
authored
close stream in historic mode instead of returning EOF (#87)
1 parent bd42c2e commit c507623

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/block_range_scanner.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ pub enum Error {
127127

128128
#[error("WebSocket connection failed after {0} attempts")]
129129
WebSocketConnectionFailed(usize),
130-
131-
#[error("End of block batch")]
132-
Eof,
133130
}
134131

135132
#[derive(Debug)]
@@ -443,7 +440,9 @@ impl<N: Network> Service<N> {
443440

444441
self.sync_historical_data(start_block, end_block).await?;
445442

446-
info!("Successfully synced historical data");
443+
_ = self.subscriber.take();
444+
445+
info!("Successfully synced historical data, closing the stream");
447446

448447
Ok(())
449448
}
@@ -548,12 +547,6 @@ impl<N: Network> Service<N> {
548547

549548
info!(batch_count = batch_count, "Historical sync completed");
550549

551-
if let Some(sender) = &self.subscriber &&
552-
sender.send(Err(Error::Eof)).await.is_err()
553-
{
554-
warn!("Subscriber channel closed, cleaning up");
555-
}
556-
557550
Ok(())
558551
}
559552

0 commit comments

Comments
 (0)