From 3bbda68adf34fe82385a96370040b6db6f6b8e51 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sun, 27 May 2018 09:54:52 +0200 Subject: [PATCH 1/2] Adjust `ExponentialBackoff` to never stop connecting --- src/redis.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/redis.rs b/src/redis.rs index 2fd6ab8c4..c9705458a 100644 --- a/src/redis.rs +++ b/src/redis.rs @@ -37,10 +37,13 @@ impl RedisActor { pub fn start>(addr: S) -> Addr { let addr = addr.into(); + let mut backoff = ExponentialBackoff::default(); + backoff.max_elapsed_time = None; + Supervisor::start(|_| RedisActor { addr: addr, cell: None, - backoff: ExponentialBackoff::default(), + backoff: backoff, queue: VecDeque::new(), }) } From 6624af63e39c55000d4493d05eecb0f8848ab633 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Sun, 27 May 2018 09:55:41 +0200 Subject: [PATCH 2/2] Keep running unconnected actor forever if `backoff` says so --- src/redis.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/redis.rs b/src/redis.rs index c9705458a..52853a433 100644 --- a/src/redis.rs +++ b/src/redis.rs @@ -77,8 +77,6 @@ impl Actor for RedisActor { // we stop current context, supervisor will restart it. if let Some(timeout) = act.backoff.next_backoff() { ctx.run_later(timeout, |_, ctx| ctx.stop()); - } else { - ctx.stop(); } } }) @@ -88,8 +86,6 @@ impl Actor for RedisActor { // we stop current context, supervisor will restart it. if let Some(timeout) = act.backoff.next_backoff() { ctx.run_later(timeout, |_, ctx| ctx.stop()); - } else { - ctx.stop(); } }) .wait(ctx);