rpush 3.3.1 → 4.0.0
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 +11 -6
- data/README.md +7 -0
- data/lib/generators/templates/add_gcm.rb +2 -2
- data/lib/generators/templates/add_rpush.rb +8 -8
- data/lib/generators/templates/create_rapns_feedback.rb +1 -1
- data/lib/generators/templates/create_rapns_notifications.rb +1 -1
- data/lib/generators/templates/rename_rapns_to_rpush.rb +4 -4
- data/lib/generators/templates/rpush_2_0_0_updates.rb +2 -2
- data/lib/rpush/cli.rb +1 -1
- data/lib/rpush/daemon/apns2/delivery.rb +0 -2
- data/lib/rpush/daemon/apnsp8/delivery.rb +0 -3
- data/lib/rpush/daemon/dispatcher/apns_http2.rb +11 -4
- data/lib/rpush/daemon/dispatcher/apnsp8_http2.rb +15 -3
- data/lib/rpush/logger.rb +1 -1
- data/lib/rpush/version.rb +3 -3
- data/spec/unit/client/active_record/pushy/notification_spec.rb +0 -6
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baf4ad12d47bddf231b3ea0ff7992cf8feab0816fc301cc43b4a41b9edeaa41e
|
4
|
+
data.tar.gz: 93a513bc8f4ab37880fb353044ad4c3349bded12906e71ffa1605380d920b2b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a2165bea0a8f1f1d7f60e8a62693a0a3fce40acb00baba990578beb965d5c258fbe231305edfa04d9c83329e5f7b1da71d0772b6399f7f9ec6359ca5fb7a2c5
|
7
|
+
data.tar.gz: 6831ddac685c0f6264242d2ccfa6be41b4a6c4a414dfa4c84734134f911df756f7e6350ca13a54a25becfc6106426feae6ef4d372e36ff72537e5d9300bde836
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,21 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
## Unreleased
|
4
4
|
|
5
|
-
-
|
5
|
+
## 4.0.0 (2019-02-14)
|
6
6
|
|
7
|
-
###
|
7
|
+
### Changed
|
8
8
|
|
9
|
-
-
|
9
|
+
- Stop logging all APNSp8 requests as warnings. [#474](https://github.com/rpush/rpush/pull/474) (by [@jhottenstein](https://github.com/jhottenstein) and [@rofreg](https://github.com/rofreg))
|
10
|
+
|
11
|
+
### Removed
|
12
|
+
|
13
|
+
- Support for Ruby 2.2
|
10
14
|
|
11
15
|
### Fixed
|
12
16
|
|
13
|
-
-
|
17
|
+
- Fixed APNSp8 memory leak [#475](https://github.com/rpush/rpush/pull/475) (by [@jhottenstein](https://github.com/jhottenstein))
|
18
|
+
- Fixed APNS2 memory leak. [#476](https://github.com/rpush/rpush/pull/476) (by [@jhottenstein](https://github.com/jhottenstein))
|
14
19
|
|
15
20
|
## 3.3.1 (2018-11-14)
|
16
21
|
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0]
|
|
50
50
|
change_column :rapns_notifications, :app_id, :integer, null: false
|
51
51
|
remove_column :rapns_notifications, :app
|
52
52
|
|
53
|
-
if ActiveRecord
|
53
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
54
54
|
if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi")
|
55
55
|
remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
|
56
56
|
elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after")
|
@@ -100,7 +100,7 @@ class AddGcm < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0]
|
|
100
100
|
AddGcm::Rapns::Notification.update_all(['app = ?', app.key], ['app_id = ?', app.id])
|
101
101
|
end
|
102
102
|
|
103
|
-
if ActiveRecord
|
103
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
104
104
|
if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi)
|
105
105
|
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
106
106
|
end
|
@@ -64,7 +64,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def self.down
|
67
|
-
if ActiveRecord
|
67
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
68
68
|
if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi')
|
69
69
|
remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
|
70
70
|
end
|
@@ -90,7 +90,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def self.down
|
93
|
-
if ActiveRecord
|
93
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
94
94
|
if index_name_exists?(:rapns_feedback, :index_rapns_feedback_on_device_token)
|
95
95
|
remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
|
96
96
|
end
|
@@ -195,7 +195,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
195
195
|
change_column :rapns_notifications, :app_id, :integer, null: false
|
196
196
|
remove_column :rapns_notifications, :app
|
197
197
|
|
198
|
-
if ActiveRecord
|
198
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
199
199
|
if index_name_exists?(:rapns_notifications, "index_rapns_notifications_multi")
|
200
200
|
remove_index :rapns_notifications, name: "index_rapns_notifications_multi"
|
201
201
|
elsif index_name_exists?(:rapns_notifications, "index_rapns_notifications_on_delivered_failed_deliver_after")
|
@@ -245,7 +245,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
245
245
|
AddGcm::Rapns::Notification.where(app_id: app.id).update_all(app: app.key)
|
246
246
|
end
|
247
247
|
|
248
|
-
if ActiveRecord
|
248
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
249
249
|
if index_name_exists?(:rapns_notifications, :index_rapns_notifications_multi)
|
250
250
|
remove_index :rapns_notifications, name: :index_rapns_notifications_multi
|
251
251
|
end
|
@@ -322,7 +322,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
322
322
|
rename_table :rapns_apps, :rpush_apps
|
323
323
|
rename_table :rapns_feedback, :rpush_feedback
|
324
324
|
|
325
|
-
if ActiveRecord
|
325
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
326
326
|
if index_name_exists?(:rpush_notifications, :index_rapns_notifications_multi)
|
327
327
|
rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
|
328
328
|
end
|
@@ -332,7 +332,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
332
332
|
end
|
333
333
|
end
|
334
334
|
|
335
|
-
if ActiveRecord
|
335
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
336
336
|
if index_name_exists?(:rpush_feedback, :index_rapns_feedback_on_device_token)
|
337
337
|
rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
|
338
338
|
end
|
@@ -364,7 +364,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
364
364
|
update_type(RenameRapnsToRpush::Rpush::App, 'Rpush::Adm::App', 'Rapns::Adm::App')
|
365
365
|
update_type(RenameRapnsToRpush::Rpush::App, 'Rpush::Wpns::App', 'Rapns::Wpns::App')
|
366
366
|
|
367
|
-
if ActiveRecord
|
367
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
368
368
|
if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi)
|
369
369
|
rename_index :rpush_notifications, :index_rpush_notifications_multi, :index_rapns_notifications_multi
|
370
370
|
end
|
@@ -374,7 +374,7 @@ class AddRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0
|
|
374
374
|
end
|
375
375
|
end
|
376
376
|
|
377
|
-
if ActiveRecord
|
377
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
378
378
|
if index_name_exists?(:rpush_feedback, :index_rpush_feedback_on_device_token)
|
379
379
|
rename_index :rpush_feedback, :index_rpush_feedback_on_device_token, :index_rapns_feedback_on_device_token
|
380
380
|
end
|
@@ -10,7 +10,7 @@ class CreateRapnsFeedback < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Mi
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.down
|
13
|
-
if ActiveRecord
|
13
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
14
14
|
if index_name_exists?(:rapns_feedback, :index_rapns_feedback_on_device_token)
|
15
15
|
remove_index :rapns_feedback, name: :index_rapns_feedback_on_device_token
|
16
16
|
end
|
@@ -21,7 +21,7 @@ class CreateRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecor
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def self.down
|
24
|
-
if ActiveRecord
|
24
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
25
25
|
if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi')
|
26
26
|
remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
|
27
27
|
end
|
@@ -18,7 +18,7 @@ class RenameRapnsToRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Mig
|
|
18
18
|
rename_table :rapns_apps, :rpush_apps
|
19
19
|
rename_table :rapns_feedback, :rpush_feedback
|
20
20
|
|
21
|
-
if ActiveRecord
|
21
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
22
22
|
if index_name_exists?(:rpush_notifications, :index_rapns_notifications_multi)
|
23
23
|
rename_index :rpush_notifications, :index_rapns_notifications_multi, :index_rpush_notifications_multi
|
24
24
|
end
|
@@ -28,7 +28,7 @@ class RenameRapnsToRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Mig
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
if ActiveRecord
|
31
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
32
32
|
if index_name_exists?(:rpush_feedback, :index_rapns_feedback_on_device_token)
|
33
33
|
rename_index :rpush_feedback, :index_rapns_feedback_on_device_token, :index_rpush_feedback_on_device_token
|
34
34
|
end
|
@@ -60,7 +60,7 @@ class RenameRapnsToRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Mig
|
|
60
60
|
update_type(RenameRapnsToRpush::Rpush::App, 'Rpush::Adm::App', 'Rapns::Adm::App')
|
61
61
|
update_type(RenameRapnsToRpush::Rpush::App, 'Rpush::Wpns::App', 'Rapns::Wpns::App')
|
62
62
|
|
63
|
-
if ActiveRecord
|
63
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
64
64
|
if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi)
|
65
65
|
rename_index :rpush_notifications, :index_rpush_notifications_multi, :index_rapns_notifications_multi
|
66
66
|
end
|
@@ -70,7 +70,7 @@ class RenameRapnsToRpush < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Mig
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
if ActiveRecord
|
73
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
74
74
|
if index_name_exists?(:rpush_feedback, :index_rpush_feedback_on_device_token)
|
75
75
|
rename_index :rpush_feedback, :index_rpush_feedback_on_device_token, :index_rapns_feedback_on_device_token
|
76
76
|
end
|
@@ -17,7 +17,7 @@ class Rpush200Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migrat
|
|
17
17
|
add_column :rpush_notifications, :processing, :boolean, null: false, default: false
|
18
18
|
add_column :rpush_notifications, :priority, :integer, null: true
|
19
19
|
|
20
|
-
if ActiveRecord
|
20
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
21
21
|
if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi)
|
22
22
|
remove_index :rpush_notifications, name: :index_rpush_notifications_multi
|
23
23
|
end
|
@@ -52,7 +52,7 @@ class Rpush200Updates < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migrat
|
|
52
52
|
change_column :rpush_feedback, :app_id, :string
|
53
53
|
rename_column :rpush_feedback, :app_id, :app
|
54
54
|
|
55
|
-
if ActiveRecord
|
55
|
+
if ActiveRecord.version >= Gem::Version.new('5.1')
|
56
56
|
if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi)
|
57
57
|
remove_index :rpush_notifications, name: :index_rpush_notifications_multi
|
58
58
|
end
|
data/lib/rpush/cli.rb
CHANGED
@@ -153,7 +153,7 @@ module Rpush
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def check_ruby_version
|
156
|
-
STDERR.puts(ANSI.yellow { 'WARNING: ' } + "You are using an old and unsupported version of Ruby.") if RUBY_VERSION < '2.
|
156
|
+
STDERR.puts(ANSI.yellow { 'WARNING: ' } + "You are using an old and unsupported version of Ruby.") if RUBY_VERSION < '2.3.0' && RUBY_ENGINE == 'ruby'
|
157
157
|
end
|
158
158
|
|
159
159
|
def underscore_option_names
|
@@ -17,8 +17,6 @@ module Rpush
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def perform
|
20
|
-
@client.on(:error) { |err| mark_batch_retryable(Time.now + 10.seconds, err) }
|
21
|
-
|
22
20
|
@batch.each_notification do |notification|
|
23
21
|
prepare_async_post(notification)
|
24
22
|
end
|
@@ -43,7 +41,6 @@ module Rpush
|
|
43
41
|
response = {}
|
44
42
|
|
45
43
|
request = build_request(notification)
|
46
|
-
log_warn(request)
|
47
44
|
http_request = @client.prepare_request(:post, request[:path],
|
48
45
|
body: request[:body],
|
49
46
|
headers: request[:headers]
|
@@ -15,10 +15,7 @@ module Rpush
|
|
15
15
|
@app = app
|
16
16
|
@delivery_class = delivery_class
|
17
17
|
|
18
|
-
|
19
|
-
@client = NetHttp2::Client.new(url,
|
20
|
-
ssl_context: prepare_ssl_context,
|
21
|
-
connect_timeout: DEFAULT_TIMEOUT)
|
18
|
+
@client = create_http2_client(app)
|
22
19
|
end
|
23
20
|
|
24
21
|
def dispatch(payload)
|
@@ -31,6 +28,16 @@ module Rpush
|
|
31
28
|
|
32
29
|
private
|
33
30
|
|
31
|
+
def create_http2_client(app)
|
32
|
+
url = URLS[app.environment.to_sym]
|
33
|
+
client = NetHttp2::Client.new(url, ssl_context: prepare_ssl_context, connect_timeout: DEFAULT_TIMEOUT)
|
34
|
+
client.on(:error) do |error|
|
35
|
+
log_error(error)
|
36
|
+
reflect(:error, error)
|
37
|
+
end
|
38
|
+
client
|
39
|
+
end
|
40
|
+
|
34
41
|
def prepare_ssl_context
|
35
42
|
@ssl_context ||= begin
|
36
43
|
ctx = OpenSSL::SSL::SSLContext.new
|
@@ -2,6 +2,8 @@ module Rpush
|
|
2
2
|
module Daemon
|
3
3
|
module Dispatcher
|
4
4
|
class Apnsp8Http2
|
5
|
+
include Loggable
|
6
|
+
include Reflectable
|
5
7
|
|
6
8
|
URLS = {
|
7
9
|
production: 'https://api.push.apple.com',
|
@@ -14,19 +16,29 @@ module Rpush
|
|
14
16
|
@app = app
|
15
17
|
@delivery_class = delivery_class
|
16
18
|
|
17
|
-
|
18
|
-
@client = NetHttp2::Client.new(url, connect_timeout: DEFAULT_TIMEOUT)
|
19
|
+
@client = create_http2_client(app)
|
19
20
|
@token_provider = Rpush::Daemon::Apnsp8::Token.new(@app)
|
20
21
|
end
|
21
22
|
|
22
23
|
def dispatch(payload)
|
23
|
-
|
24
24
|
@delivery_class.new(@app, @client, @token_provider, payload.batch).perform
|
25
25
|
end
|
26
26
|
|
27
27
|
def cleanup
|
28
28
|
@client.close
|
29
29
|
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def create_http2_client(app)
|
34
|
+
url = URLS[app.environment.to_sym]
|
35
|
+
client = NetHttp2::Client.new(url, connect_timeout: DEFAULT_TIMEOUT)
|
36
|
+
client.on(:error) do |error|
|
37
|
+
log_error(error)
|
38
|
+
reflect(:error, error)
|
39
|
+
end
|
40
|
+
client
|
41
|
+
end
|
30
42
|
end
|
31
43
|
end
|
32
44
|
end
|
data/lib/rpush/logger.rb
CHANGED
@@ -65,7 +65,7 @@ module Rpush
|
|
65
65
|
|
66
66
|
def log(where, msg, inline = false, prefix = nil, io = STDOUT)
|
67
67
|
if msg.is_a?(Exception)
|
68
|
-
formatted_backtrace = msg.backtrace
|
68
|
+
formatted_backtrace = msg.backtrace&.join("\n")
|
69
69
|
msg = "#{msg.class.name}, #{msg.message}\n#{formatted_backtrace}"
|
70
70
|
end
|
71
71
|
|
data/lib/rpush/version.rb
CHANGED
@@ -49,12 +49,6 @@ describe Rpush::Client::ActiveRecord::Pushy::Notification do
|
|
49
49
|
expect(subject.errors[:time_to_live]).to eq ['must be greater than 0']
|
50
50
|
end
|
51
51
|
|
52
|
-
it 'should be integer' do
|
53
|
-
subject.time_to_live = 1.4
|
54
|
-
is_expected.not_to be_valid
|
55
|
-
expect(subject.errors[:time_to_live]).to eq ['must be an integer']
|
56
|
-
end
|
57
|
-
|
58
52
|
it 'should be <= 1.year.seconds' do
|
59
53
|
subject.time_to_live = 2.years.seconds.to_i
|
60
54
|
is_expected.not_to be_valid
|
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
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Leitch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -202,14 +202,14 @@ dependencies:
|
|
202
202
|
name: modis
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
204
204
|
requirements:
|
205
|
-
- - "
|
205
|
+
- - ">="
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '2.0'
|
208
208
|
type: :development
|
209
209
|
prerelease: false
|
210
210
|
version_requirements: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
|
-
- - "
|
212
|
+
- - ">="
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '2.0'
|
215
215
|
- !ruby/object:Gem::Dependency
|
@@ -618,15 +618,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
618
618
|
requirements:
|
619
619
|
- - ">="
|
620
620
|
- !ruby/object:Gem::Version
|
621
|
-
version: 2.
|
621
|
+
version: 2.3.0
|
622
622
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
623
623
|
requirements:
|
624
624
|
- - ">="
|
625
625
|
- !ruby/object:Gem::Version
|
626
626
|
version: '0'
|
627
627
|
requirements: []
|
628
|
-
|
629
|
-
rubygems_version: 2.7.6
|
628
|
+
rubygems_version: 3.0.1
|
630
629
|
signing_key:
|
631
630
|
specification_version: 4
|
632
631
|
summary: The push notification service for Ruby.
|