-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle timeout config for apns:connect/1 #171
Conversation
src/apns_connection.erl
Outdated
@@ -332,10 +339,9 @@ get_device_path(DeviceId) -> | |||
add_authorization_header(Headers, Token) -> | |||
Headers#{apns_auth_token => <<"bearer ", Token/binary>>}. | |||
|
|||
-spec push(pid(), apns:device_id(), apns:headers(), notification()) -> | |||
-spec push(pid(), apns:device_id(), apns:headers(), notification(), integer()) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 342 is too long: -spec push(pid(), apns:device_id(), apns:headers(), notification(), integer()) ->.
src/apns_connection.erl
Outdated
@@ -228,8 +235,8 @@ handle_info(reconnect, State) -> | |||
{ok, _} = timer:send_after(Sleep, reconnect), | |||
{noreply, State#{backoff => Backoff + 1}} | |||
end; | |||
handle_info(timeout, #{gun_connection := GunConn, client := Client} = State) -> | |||
{ok, Timeout} = application:get_env(apns, timeout), | |||
handle_info(timeout, #{connection := Connection, gun_connection := GunConn, client := Client} = State) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 238 is too long: handle_info(timeout, #{connection := Connection, gun_connection := GunConn, client := Client} = State) ->.
src/apns_connection.erl
Outdated
@@ -332,10 +340,9 @@ get_device_path(DeviceId) -> | |||
add_authorization_header(Headers, Token) -> | |||
Headers#{apns_auth_token => <<"bearer ", Token/binary>>}. | |||
|
|||
-spec push(pid(), apns:device_id(), apns:headers(), notification()) -> | |||
-spec push(pid(), apns:device_id(), apns:headers(), notification(), integer()) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 343 is too long: -spec push(pid(), apns:device_id(), apns:headers(), notification(), integer()) ->.
hi @dcy , thanks for your contribution. |
When i use |
@ferigis also, @dcy's alternative makes the timeout configurable per-connection, instead of being an application-wide parameter. #{timeout := Timeout} = Connection …instead of… Timeout = maps:get(timeout, Connection) …but that's just bike-shedding. |
@dcy merged! thanks for the contribution! :) |
Hi! When i use
apns:connect/1
to open my connections, I must add the timeout config tosys.config
:So i think the
timeout
should save inConnection
, not useapplication:get_env(apns, timeout)
(exceptdefault_connection
).