Skip to content

Commit

Permalink
Merge pull request #70 from tkrs/fix/reconnect
Browse files Browse the repository at this point in the history
Cleanup reconnect handling
  • Loading branch information
tkrs authored Mar 1, 2019
2 parents 607dfb4 + fb1a546 commit 4ce5e31
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 262 deletions.
10 changes: 5 additions & 5 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl WorkerPool {
let receiver = Arc::new(Mutex::new(receiver));

for id in 0..settings.workers {
debug!("Worker {} creating...", id);
info!("Worker {} creating...", id);
let conn_settings = connect::ConnectionSettings {
connect_retry_initial_delay: settings.connection_retry_initial_delay,
connect_retry_max_delay: settings.connection_retry_max_delay,
Expand Down Expand Up @@ -113,21 +113,21 @@ impl Client for WorkerPool {

fn close(&mut self) {
if self.closed.fetch_or(true, Ordering::SeqCst) {
debug!("Workers are already closed.");
info!("Workers are already closed.");
return;
}

debug!("Sending terminate message to all workers.");
info!("Sending terminate message to all workers.");

for _ in &mut self.workers {
let sender = self.sender.clone();
sender.send(Message::Terminate).unwrap();
}

debug!("Shutting down all workers.");
info!("Shutting down all workers.");

for wkr in &mut self.workers {
debug!("Shutting down worker {}", wkr.id);
info!("Shutting down worker {}", wkr.id);

if let Some(w) = wkr.handler.take() {
w.join().unwrap();
Expand Down
Loading

0 comments on commit 4ce5e31

Please sign in to comment.