Skip to content

Commit 32b4363

Browse files
authored
Merge pull request dmnd-pool#70 from Priceless-P/fix/increse-epsilon
increase epsilon
2 parents 40ae66d + 021a3db commit 32b4363

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "demand-cli"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
edition = "2021"
55

66
[dependencies]

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async fn main() {
9292
});
9393

9494
let mut router = router::Router::new(pool_addresses, auth_pub_k, None, None);
95-
let epsilon = Duration::from_millis(10);
95+
let epsilon = Duration::from_millis(30_000);
9696
let best_upstream = router.select_pool_connect().await;
9797
initialize_proxy(&mut router, best_upstream, epsilon).await;
9898
info!("exiting");

src/router/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ impl Router {
104104
return None;
105105
}
106106
};
107-
if best_pool_latency < (current_latency - epsilon) {
107+
// saturating_sub is used to avoid panic on negative duration result
108+
if best_pool_latency < current_latency.saturating_sub(epsilon) {
108109
info!(
109110
"Found faster pool: {:?} with latency {:?}",
110111
best_pool, best_pool_latency
@@ -160,7 +161,6 @@ impl Router {
160161
crate::POOL_ADDRESS
161162
.safe_lock(|pool_address| {
162163
*pool_address = Some(pool);
163-
println!("Pool: {:?}", pool_address)
164164
})
165165
.unwrap_or_else(|_| {
166166
error!("Pool address Mutex corrupt");

0 commit comments

Comments
 (0)