Skip to content

Commit a69acce

Browse files
committed
eth: add print_verbosity fields to subscribe_loop
1 parent c09846f commit a69acce

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/eth.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,27 @@ impl Provider {
666666
}
667667

668668
/// Subscribe in a loop until successful
669-
pub fn subscribe_loop(&self, sub_id: u64, filter: Filter) {
669+
pub fn subscribe_loop(
670+
&self,
671+
sub_id: u64,
672+
filter: Filter,
673+
print_verbosity_success: u8,
674+
print_verbosity_error: u8,
675+
) {
670676
loop {
671677
match self.subscribe(sub_id, filter.clone()) {
672678
Ok(()) => break,
673679
Err(_) => {
674680
crate::print_to_terminal(
675-
0,
681+
print_verbosity_error,
676682
"failed to subscribe to chain! trying again in 5s...",
677683
);
678684
std::thread::sleep(std::time::Duration::from_secs(5));
679685
continue;
680686
}
681687
}
682688
}
683-
crate::print_to_terminal(0, "subscribed to logs successfully");
689+
crate::print_to_terminal(print_verbosity_success, "subscribed to logs successfully");
684690
}
685691

686692
/// Unsubscribes from a previously created subscription.

0 commit comments

Comments
 (0)