Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 0.9.2 (Next)

* [#161](https://github.com/slack-ruby/slack-ruby-client/pull/161): Added support for cursor pagination - [@dblock](https://github.com/dblock).
* [#162](https://github.com/slack-ruby/slack-ruby-client/pull/162): Gracefully close websocket on Errno::EPIPE - [@johanoskarsson](https://github.com/johanoskarsson).
* Your contribution here.

### 0.9.1 (8/24/2017)
Expand Down
2 changes: 1 addition & 1 deletion lib/slack/real_time/concurrency/celluloid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def run_loop
@connected = @socket.connect
driver.start
loop { read } if socket
rescue EOFError => e
rescue EOFError, Errno::EPIPE => e
logger.debug("#{self.class}##{__method__}") { e }
driver.emit(:close, WebSocket::Driver::CloseEvent.new(1001, 'server closed connection')) unless @closing
ensure
Expand Down
16 changes: 16 additions & 0 deletions spec/slack/real_time/concurrency/celluloid_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ def read
socket.run_loop
end
end

describe '#run_loop with epipe' do
let(:test_socket) do
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets reorganize this a bit? There should be a default test socket for a bunch of tests. Then the fail scenarios should be separate with something like

[Errno::EPIPE,  EOFError].each do |ex|
 context "when #{ex} is raised" do
 ...
 end
end

Class.new(described_class) do
def read
fail Errno::EPIPE
end
end
end

it 'runs' do
expect(ws).to receive(:emit)
expect(ws).to receive(:start)
socket.run_loop
end
end
end

pending 'send_data'
Expand Down