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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3abc70a76bc7de39565ab73f4eef2b2466ff4dec4fe20ef57e10a9c4e6ff41f3
4
- data.tar.gz: 42eb70527bd235e7c30b1dab4413d9368f68c129254704bb5af7698cb8cd6c68
3
+ metadata.gz: baf4ad12d47bddf231b3ea0ff7992cf8feab0816fc301cc43b4a41b9edeaa41e
4
+ data.tar.gz: 93a513bc8f4ab37880fb353044ad4c3349bded12906e71ffa1605380d920b2b1
5
5
  SHA512:
6
- metadata.gz: 19b1eeb3bb0e71dd11cd26af20efdb610cdda31c720293578e57d19b82c406841fe33f8aa63d6e4dd5ecff8e18bbcc5a760159259cc78c37aa093a29a70d059a
7
- data.tar.gz: 75a2fc1eb17241bbaa7fcf3577ef6ba27ac5701f3e4a5396b08f099097b9a686aae9b465c954272871ee33c6c65d4142b4183c5bb17f60e731a1f70e5328c97e
6
+ metadata.gz: 0a2165bea0a8f1f1d7f60e8a62693a0a3fce40acb00baba990578beb965d5c258fbe231305edfa04d9c83329e5f7b1da71d0772b6399f7f9ec6359ca5fb7a2c5
7
+ data.tar.gz: 6831ddac685c0f6264242d2ccfa6be41b4a6c4a414dfa4c84734134f911df756f7e6350ca13a54a25becfc6106426feae6ef4d372e36ff72537e5d9300bde836
@@ -1,16 +1,21 @@
1
- ## HEAD
1
+ # Changelog
2
2
 
3
- ### Breaking Changes
3
+ ## Unreleased
4
4
 
5
- - None
5
+ ## 4.0.0 (2019-02-14)
6
6
 
7
- ### Added
7
+ ### Changed
8
8
 
9
- - None
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
- - None
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
@@ -269,6 +269,13 @@ $ cd /path/to/project
269
269
  $ rpush start
270
270
  ```
271
271
 
272
+ #### As a foreground process
273
+
274
+ ```sh
275
+ $ cd /path/to/project
276
+ $ rpush start -f
277
+ ```
278
+
272
279
  #### On the command-line
273
280
 
274
281
  ```sh
@@ -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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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::VERSION::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 1
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
@@ -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.2.2' && RUBY_ENGINE == 'ruby'
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
@@ -15,8 +15,6 @@ module Rpush
15
15
  end
16
16
 
17
17
  def perform
18
- @client.on(:error) { |err| mark_batch_retryable(Time.now + 10.seconds, err) }
19
-
20
18
  @batch.each_notification do |notification|
21
19
  prepare_async_post(notification)
22
20
  end
@@ -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
- url = URLS[app.environment.to_sym]
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
- url = URLS[app.environment.to_sym]
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
@@ -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.join("\n")
68
+ formatted_backtrace = msg.backtrace&.join("\n")
69
69
  msg = "#{msg.class.name}, #{msg.message}\n#{formatted_backtrace}"
70
70
  end
71
71
 
@@ -1,8 +1,8 @@
1
1
  module Rpush
2
2
  module VERSION
3
- MAJOR = 3
4
- MINOR = 3
5
- TINY = 1
3
+ MAJOR = 4
4
+ MINOR = 0
5
+ TINY = 0
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
@@ -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: 3.3.1
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: 2018-11-14 00:00:00.000000000 Z
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.2.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
- rubyforge_project:
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.