From 4605f24fa17e31434b9de2be6dca469ff5d26e70 Mon Sep 17 00:00:00 2001 From: Brandt Lareau Date: Wed, 8 Mar 2017 18:15:26 -0500 Subject: [PATCH] Fix: check that the current Celluloid actor is running before calling terminate. --- 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 ce0e309f..928ea1ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * [#135](https://github.com/slack-ruby/slack-ruby-client/issues/135): Added `timeout` and `open_timeout` options to Web API - [@dblock](https://github.com/dblock). * [#134](https://github.com/slack-ruby/slack-ruby-client/issues/134): Set `start_options[:request][:timeout]`, used with `rtm.start` in `Slack::RealTime::Client`, to 180 seconds - [@dblock](https://github.com/dblock). * [#136](https://github.com/slack-ruby/slack-ruby-client/pull/136): Pass request options in web client calls - [@dblock](https://github.com/dblock). +* [#121](https://github.com/slack-ruby/slack-ruby-client/pull/121): Fix: check that the current Celluloid actor is running before calling `terminate` - [@newdark](https://github.com/newdark). * Your contribution here. ### 0.7.9 (2/9/2017) diff --git a/lib/slack/real_time/concurrency/celluloid.rb b/lib/slack/real_time/concurrency/celluloid.rb index 4e31b320..672fe2e2 100644 --- a/lib/slack/real_time/concurrency/celluloid.rb +++ b/lib/slack/real_time/concurrency/celluloid.rb @@ -38,7 +38,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