rpush 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: baf4ad12d47bddf231b3ea0ff7992cf8feab0816fc301cc43b4a41b9edeaa41e
4
- data.tar.gz: 93a513bc8f4ab37880fb353044ad4c3349bded12906e71ffa1605380d920b2b1
3
+ metadata.gz: c92f2053a81534384b1439e958afc67fe51913fb4144abe0e0a60edda626f37f
4
+ data.tar.gz: fb6d691def9b053fd6eba40244dd84adebfbb549a5d02d4310381bfadbb06bc9
5
5
  SHA512:
6
- metadata.gz: 0a2165bea0a8f1f1d7f60e8a62693a0a3fce40acb00baba990578beb965d5c258fbe231305edfa04d9c83329e5f7b1da71d0772b6399f7f9ec6359ca5fb7a2c5
7
- data.tar.gz: 6831ddac685c0f6264242d2ccfa6be41b4a6c4a414dfa4c84734134f911df756f7e6350ca13a54a25becfc6106426feae6ef4d372e36ff72537e5d9300bde836
6
+ metadata.gz: 980046a8d527a44066937d54e32fea017d8afbd0177a027ec78a21fe31ddaf28bc075c8ddcb9ce2785b453e0d16fe011473de985bb4155882957e11067fd305a
7
+ data.tar.gz: 99cac2e5c9e4d06e190f27eef97adf41f388d4e9a9116dd9e7beb8b013fe853138c1ef55fa92ea9a82ad9297db544d3d7ead18c568f43a5ced72d6ebacc2e487
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.0.1 (2019-04-04)
6
+
7
+ ### Fixed
8
+
9
+ - Fail gracefully when a Modis notification no longer exists [#486](https://github.com/rpush/rpush/pull/486) (by [@rofreg](https://github.com/rofreg)).
10
+
5
11
  ## 4.0.0 (2019-02-14)
6
12
 
7
13
  ### Changed
@@ -17,7 +17,7 @@ module Rpush
17
17
  limit -= retryable_ids.size
18
18
  pending_ids = limit > 0 ? pending_notification_ids(limit) : []
19
19
  ids = retryable_ids + pending_ids
20
- ids.map { |id| Rpush::Client::Redis::Notification.find(id) }
20
+ ids.map { |id| find_notification_by_id(id) }.compact
21
21
  end
22
22
 
23
23
  def mark_delivered(notification, time, opts = {})
@@ -49,7 +49,12 @@ module Rpush
49
49
  end
50
50
 
51
51
  def mark_ids_failed(ids, code, description, time)
52
- ids.each { |id| mark_failed(Rpush::Client::Redis::Notification.find(id), code, description, time) }
52
+ ids.each do |id|
53
+ notification = find_notification_by_id(id)
54
+ next unless notification
55
+
56
+ mark_failed(notification, code, description, time)
57
+ end
53
58
  end
54
59
 
55
60
  def mark_retryable(notification, deliver_after, opts = {})
@@ -75,7 +80,12 @@ module Rpush
75
80
  end
76
81
 
77
82
  def mark_ids_retryable(ids, deliver_after)
78
- ids.each { |id| mark_retryable(Rpush::Client::Redis::Notification.find(id), deliver_after) }
83
+ ids.each do |id|
84
+ notification = find_notification_by_id(id)
85
+ next unless notification
86
+
87
+ mark_retryable(notification, deliver_after)
88
+ end
79
89
  end
80
90
 
81
91
  def create_apns_feedback(failed_at, device_token, app)
@@ -121,6 +131,13 @@ module Rpush
121
131
 
122
132
  private
123
133
 
134
+ def find_notification_by_id(id)
135
+ Rpush::Client::Redis::Notification.find(id)
136
+ rescue Modis::RecordNotFound
137
+ Rpush.logger.warn("Couldn't find Rpush::Client::Redis::Notification with id=#{id}")
138
+ nil
139
+ end
140
+
124
141
  def create_gcm_like_notification(notification, attrs, data, registration_ids, deliver_after, app) # rubocop:disable ParameterLists
125
142
  notification.assign_attributes(attrs)
126
143
  notification.data = data
@@ -2,7 +2,7 @@ module Rpush
2
2
  module VERSION
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
@@ -116,6 +116,14 @@ describe Rpush::Daemon::Store::Redis do
116
116
  notification.reload
117
117
  end.to change { notification.deliver_after.try(:utc).to_s }.to(deliver_after.utc.to_s)
118
118
  end
119
+
120
+ it 'ignores IDs that do not exist without throwing an exception' do
121
+ notification.destroy
122
+ expect(logger).to receive(:warn).with("Couldn't find Rpush::Client::Redis::Notification with id=#{notification.id}")
123
+ expect do
124
+ store.mark_ids_retryable([notification.id], deliver_after)
125
+ end.not_to raise_exception
126
+ end
119
127
  end
120
128
 
121
129
  describe 'mark_batch_retryable' do
@@ -239,6 +247,14 @@ describe Rpush::Daemon::Store::Redis do
239
247
  notification.reload
240
248
  end.to change(notification, :failed).to(true)
241
249
  end
250
+
251
+ it 'ignores IDs that do not exist without throwing an exception' do
252
+ notification.destroy
253
+ expect(logger).to receive(:warn).with("Couldn't find Rpush::Client::Redis::Notification with id=#{notification.id}")
254
+ expect do
255
+ store.mark_ids_failed([notification.id], nil, '', Time.now)
256
+ end.not_to raise_exception
257
+ end
242
258
  end
243
259
 
244
260
  describe 'mark_batch_failed' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpush
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-14 00:00:00.000000000 Z
11
+ date: 2019-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -240,20 +240,6 @@ dependencies:
240
240
  - - ">="
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
- - !ruby/object:Gem::Dependency
244
- name: cane
245
- requirement: !ruby/object:Gem::Requirement
246
- requirements:
247
- - - ">="
248
- - !ruby/object:Gem::Version
249
- version: '0'
250
- type: :development
251
- prerelease: false
252
- version_requirements: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - ">="
255
- - !ruby/object:Gem::Version
256
- version: '0'
257
243
  - !ruby/object:Gem::Dependency
258
244
  name: codeclimate-test-reporter
259
245
  requirement: !ruby/object:Gem::Requirement
@@ -529,7 +515,6 @@ files:
529
515
  - lib/rpush/reflection_collection.rb
530
516
  - lib/rpush/reflection_public_methods.rb
531
517
  - lib/rpush/version.rb
532
- - lib/tasks/quality.rake
533
518
  - lib/tasks/test.rake
534
519
  - spec/.rubocop.yml
535
520
  - spec/functional/adm_spec.rb
@@ -625,7 +610,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
625
610
  - !ruby/object:Gem::Version
626
611
  version: '0'
627
612
  requirements: []
628
- rubygems_version: 3.0.1
613
+ rubygems_version: 3.0.3
629
614
  signing_key:
630
615
  specification_version: 4
631
616
  summary: The push notification service for Ruby.
@@ -1,35 +0,0 @@
1
- begin
2
- require 'cane/rake_task'
3
-
4
- desc 'Run cane to check quality metrics'
5
- Cane::RakeTask.new(:cane_quality) do |cane|
6
- cane.add_threshold 'coverage/covered_percent', :>=, 80
7
- cane.no_style = false
8
- cane.style_measure = 1000
9
- cane.no_doc = true
10
- cane.abc_max = 22
11
- end
12
-
13
- namespace :spec do
14
- task cane: %w(spec cane_quality)
15
- end
16
- rescue LoadError
17
- warn "cane not available."
18
-
19
- namespace :spec do
20
- task cane: ['spec']
21
- end
22
- end
23
-
24
- begin
25
- require 'rubocop/rake_task'
26
- t = RuboCop::RakeTask.new
27
- t.options << '-D'
28
- rescue LoadError
29
- warn 'rubocop not available.'
30
- task rubocop: ['spec']
31
- end
32
-
33
- namespace :spec do
34
- task quality: %w(cane rubocop)
35
- end