Skip to content

Commit

Permalink
Add temp logging to debug SSL error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Katkova committed Jan 18, 2022
1 parent 4fd09a8 commit 8b856dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rpush/daemon/apns2/delivery.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def initialize(app, http2_client, batch)

def perform
@batch.each_notification do |notification|
prepare_async_post(notification)
begin
prepare_async_post(notification)
rescue OpenSSL::SSL::SSLError => error
log_error("Notification #{notification.id} failed with SSL error")
end
end

# Send all preprocessed requests at once
Expand Down
12 changes: 12 additions & 0 deletions spec/functional/apns2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ def create_notification
end
end

context 'when SSL error occurs' do
before(:each) do
expect(fake_client).to receive(:call_async) { raise(OpenSSL::SSL::SSLError) }
end

it 'logs the error' do
expect(Rpush.logger).to receive(:error)
create_notification
Rpush.push
end
end

context 'when waiting for requests to complete times out' do
let(:on_close) do
proc { |&block| @thread = Thread.new { sleep(0.01) } }
Expand Down

0 comments on commit 8b856dc

Please sign in to comment.