action_push_native 0.2.1 → 0.3.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: bb63f1d3b677a29544c2691f401106285c40a3d2ef023f58c814d0afbb6ac500
4
- data.tar.gz: 1a14922fd7f365aa860634cdd590da4047f03bf3ce6b200a91a103c6b17b04f0
3
+ metadata.gz: 1136dcc9cab40bcc1e6c8432841981cea0f21f8dc7ac70735cc595f7d79cf6a6
4
+ data.tar.gz: b397de4ce3970c7c255271e184eaa49d1e15518a43c801c07397a37985f88fb8
5
5
  SHA512:
6
- metadata.gz: 78149ea68432d42200e2fe22cfb8d676b96acfebfcf169a17bc4b78dbd1c48eb7b082718ed1e382529e4fea0a505622319f487136e80ecef5b4ef8b169a280eb
7
- data.tar.gz: 2f479abecd271700608b73ecd4ebba476449774dae7349951af959709886b7164f9896b88f91d04e093884ee53e953b3cc1719728d55b9591866280129c79184
6
+ metadata.gz: 5802271587c60f66a7aab9a99f37fa715feddb61dd6e4881fac825e2e517a6104d6144b8998125195f1742ea66152731ede28fdb792eb04db2a7ec3f8b1a3873
7
+ data.tar.gz: 4044a51c31d921df83f7c451d6416d689a93f2ca8cac55ff0f50a45b186de4697f717f39d581738d69012091a61d881f5ddfadd615f2a62709d962fa2fcd56c2
@@ -40,7 +40,7 @@ module ActionPushNative
40
40
 
41
41
  with_options retry_options do
42
42
  retry_on TimeoutError, wait: 1.minute
43
- retry_on ConnectionError, HTTPX::PoolTimeoutError, attempts: 20
43
+ retry_on ConnectionError, ConnectionPoolTimeoutError, attempts: 20
44
44
 
45
45
  # Altough unexpected, these are short-lived errors that can be retried most of the times.
46
46
  retry_on ForbiddenError, BadRequestError
@@ -3,6 +3,7 @@
3
3
  module ActionPushNative
4
4
  class TimeoutError < StandardError; end
5
5
  class ConnectionError < StandardError; end
6
+ class ConnectionPoolTimeoutError < StandardError; end
6
7
 
7
8
  class BadRequestError < StandardError; end
8
9
  class ForbiddenError < StandardError; end
@@ -5,9 +5,6 @@ module ActionPushNative
5
5
  class Apns
6
6
  include NetworkErrorHandling
7
7
 
8
- # Per-application HTTPX session
9
- cattr_accessor :httpx_sessions
10
-
11
8
  def initialize(config)
12
9
  @config = config
13
10
  end
@@ -59,9 +56,11 @@ module ActionPushNative
59
56
  payload.compact
60
57
  end
61
58
 
59
+ HTTPX_SESSIONS_KEY = :action_push_native_apns_httpx_sessions
60
+
62
61
  def httpx_session
63
- self.class.httpx_sessions ||= {}
64
- self.class.httpx_sessions[config] ||= HttpxSession.new(config)
62
+ ActiveSupport::IsolatedExecutionState[HTTPX_SESSIONS_KEY] ||= {}
63
+ ActiveSupport::IsolatedExecutionState[HTTPX_SESSIONS_KEY][config] ||= HttpxSession.new(config)
65
64
  end
66
65
 
67
66
  def handle_error(response)
@@ -5,9 +5,6 @@ module ActionPushNative
5
5
  class Fcm
6
6
  include NetworkErrorHandling
7
7
 
8
- # Per-application HTTPX session
9
- cattr_accessor :httpx_sessions
10
-
11
8
  def initialize(config)
12
9
  @config = config
13
10
  end
@@ -20,9 +17,11 @@ module ActionPushNative
20
17
  private
21
18
  attr_reader :config
22
19
 
20
+ HTTPX_SESSIONS_KEY = :action_push_native_fcm_httpx_sessions
21
+
23
22
  def httpx_session
24
- self.class.httpx_sessions ||= {}
25
- self.class.httpx_sessions[config] ||= HttpxSession.new(config)
23
+ ActiveSupport::IsolatedExecutionState[HTTPX_SESSIONS_KEY] ||= {}
24
+ ActiveSupport::IsolatedExecutionState[HTTPX_SESSIONS_KEY][config] ||= HttpxSession.new(config)
26
25
  end
27
26
 
28
27
  def payload_from(notification)
@@ -4,7 +4,7 @@ module ActionPushNative::Service::NetworkErrorHandling
4
4
  def handle_network_error(error)
5
5
  case error
6
6
  when HTTPX::PoolTimeoutError
7
- raise error
7
+ raise ActionPushNative::ConnectionPoolTimeoutError, error.message
8
8
  when Errno::ETIMEDOUT, HTTPX::TimeoutError
9
9
  raise ActionPushNative::TimeoutError, error.message
10
10
  when Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH,
@@ -1,3 +1,3 @@
1
1
  module ActionPushNative
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -11,7 +11,7 @@ shared:
11
11
  topic: your.bundle.identifier
12
12
 
13
13
  # Set this to the number of threads used to process notifications (default: 5).
14
- # When the pool size is too small a HTTPX::PoolTimeoutError error will be raised.
14
+ # When the pool size is too small a ConnectionPoolTimeoutError will be raised.
15
15
  # connection_pool_size: 5
16
16
 
17
17
  # Change the request timeout (default: 30).
@@ -21,7 +21,7 @@ shared:
21
21
  # Please note that anything built directly from Xcode and loaded on your phone will have
22
22
  # the app generate DEVELOPMENT tokens, while everything else (TestFlight, Apple Store, ...)
23
23
  # will be considered as PRODUCTION environment.
24
- # connect_to_development_server: <%%# Rails.env.development? %>
24
+ # connect_to_development_server: <%%= Rails.env.development? %>
25
25
 
26
26
  # Use bin/rails credentials:edit to set the fcm secrets (as action_push_native:fcm:encryption_key)
27
27
  google:
@@ -33,7 +33,7 @@ shared:
33
33
  project_id: your_project_id
34
34
 
35
35
  # Set this to the number of threads used to process notifications (default: 5).
36
- # When the pool size is too small a HTTPX::PoolTimeoutError error will be raised.
36
+ # When the pool size is too small a ConnectionPoolTimeoutError will be raised.
37
37
  # connection_pool_size: 5
38
38
 
39
39
  # Change the request timeout (default: 15).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_push_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacopo Beschi
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.6.9
148
+ rubygems_version: 4.0.3
149
149
  specification_version: 4
150
150
  summary: Send push notifications to mobile apps
151
151
  test_files: []