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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/rpush/daemon/store/redis.rb +20 -3
- data/lib/rpush/version.rb +1 -1
- data/spec/unit/daemon/store/redis_spec.rb +16 -0
- metadata +3 -18
- data/lib/tasks/quality.rake +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92f2053a81534384b1439e958afc67fe51913fb4144abe0e0a60edda626f37f
|
4
|
+
data.tar.gz: fb6d691def9b053fd6eba40244dd84adebfbb549a5d02d4310381bfadbb06bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 980046a8d527a44066937d54e32fea017d8afbd0177a027ec78a21fe31ddaf28bc075c8ddcb9ce2785b453e0d16fe011473de985bb4155882957e11067fd305a
|
7
|
+
data.tar.gz: 99cac2e5c9e4d06e190f27eef97adf41f388d4e9a9116dd9e7beb8b013fe853138c1ef55fa92ea9a82ad9297db544d3d7ead18c568f43a5ced72d6ebacc2e487
|
data/CHANGELOG.md
CHANGED
@@ -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|
|
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
|
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
|
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
|
data/lib/rpush/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
613
|
+
rubygems_version: 3.0.3
|
629
614
|
signing_key:
|
630
615
|
specification_version: 4
|
631
616
|
summary: The push notification service for Ruby.
|
data/lib/tasks/quality.rake
DELETED
@@ -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
|