From 1ccfc0720b410ec25e3152184628917dc1849362 Mon Sep 17 00:00:00 2001 From: Brandt Lareau Date: Wed, 9 Nov 2016 12:40:12 -0600 Subject: [PATCH] Checking the current actor is running not just that it is alive The check for the alive should stay as it could be running but not alive which is not likely but possible. --- CHANGELOG.md | 1 + lib/slack/real_time/concurrency/celluloid.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f9e2dab..82b3e8b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * [#116](https://github.com/slack-ruby/slack-ruby-client/pull/116): Use [slack-ruby/slack-api-ref](https://github.com/slack-ruby/slack-api-ref) as machine API reference - [@dblock](https://github.com/dblock). * [#116](https://github.com/slack-ruby/slack-ruby-client/pull/116): Added `users_setPhoto` and `users_deletePhoto` to Web API - [@dblock](https://github.com/dblock). * [#81](https://github.com/slack-ruby/slack-ruby-client/pull/81): Require faraday 0.9.0 or newer - [@leppert](https://github.com/leppert). +* [#121](https://github.com/slack-ruby/slack-ruby-client/pull/121): Checking the current actor is running before calling terminate - [@newdark](https://github.com/newdark). * Your contribution here. ### 0.7.7 (8/29/2016) diff --git a/lib/slack/real_time/concurrency/celluloid.rb b/lib/slack/real_time/concurrency/celluloid.rb index 20aecf6e..6ae20bb8 100644 --- a/lib/slack/real_time/concurrency/celluloid.rb +++ b/lib/slack/real_time/concurrency/celluloid.rb @@ -39,7 +39,7 @@ def run_loop logger.debug("#{self.class}##{__method__}") { e } driver.emit(:close, WebSocket::Driver::CloseEvent.new(1001, 'server closed connection')) unless @closing ensure - current_actor.terminate if current_actor.alive? + current_actor.terminate if current_actor.alive? && current_actor.running? end def close