Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temp logging #5

Closed
wants to merge 2 commits into from
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
2 changes: 2 additions & 0 deletions lib/rpush/client/redis/apns/feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module Apns
class Feedback
include Modis::Model

enable_all_index false # prevent creation of rpush:rpush:client:redis:apns:feedback:all set

attribute :app_id, :integer
attribute :device_token, :string
attribute :failed_at, :timestamp
Expand Down
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
Loading