action_push_native 0.2.0 → 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 +4 -4
- data/app/jobs/action_push_native/notification_job.rb +1 -1
- data/lib/action_push_native/errors.rb +1 -0
- data/lib/action_push_native/service/apns.rb +4 -5
- data/lib/action_push_native/service/fcm.rb +4 -5
- data/lib/action_push_native/service/network_error_handling.rb +2 -0
- data/lib/action_push_native/version.rb +1 -1
- data/lib/generators/action_push_native/install/templates/config/push.yml.tt +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1136dcc9cab40bcc1e6c8432841981cea0f21f8dc7ac70735cc595f7d79cf6a6
|
|
4
|
+
data.tar.gz: b397de4ce3970c7c255271e184eaa49d1e15518a43c801c07397a37985f88fb8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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,
|
|
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
|
|
@@ -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
|
-
|
|
64
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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)
|
|
@@ -3,6 +3,8 @@ module ActionPushNative::Service::NetworkErrorHandling
|
|
|
3
3
|
|
|
4
4
|
def handle_network_error(error)
|
|
5
5
|
case error
|
|
6
|
+
when HTTPX::PoolTimeoutError
|
|
7
|
+
raise ActionPushNative::ConnectionPoolTimeoutError, error.message
|
|
6
8
|
when Errno::ETIMEDOUT, HTTPX::TimeoutError
|
|
7
9
|
raise ActionPushNative::TimeoutError, error.message
|
|
8
10
|
when Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH,
|
|
@@ -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
|
|
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:
|
|
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
|
|
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.
|
|
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:
|
|
148
|
+
rubygems_version: 4.0.3
|
|
149
149
|
specification_version: 4
|
|
150
150
|
summary: Send push notifications to mobile apps
|
|
151
151
|
test_files: []
|