Comparing version 9.2.0 to 9.3.0
@@ -7,2 +7,6 @@ # Change Log | ||
## [9.3.0](https://github.com/AndrewBarba/apns2/releases/tag/9.3.0) | ||
1. Update token refresh logic to avoid `TooManyProviderTokenUpdates` | ||
## [9.2.0](https://github.com/AndrewBarba/apns2/releases/tag/9.2.0) | ||
@@ -9,0 +13,0 @@ |
@@ -72,6 +72,3 @@ const { EventEmitter } = require('events') | ||
this._client = new Http2Client(host, { port, requestTimeout, pingInterval }) | ||
this._resetTokenInterval = setInterval( | ||
() => this._resetSigningToken(), | ||
RESET_TOKEN_INTERVAL_MS | ||
).unref() | ||
this._token = null | ||
this.on(Errors.expiredProviderToken, () => this._resetSigningToken()) | ||
@@ -179,4 +176,4 @@ } | ||
_getSigningToken() { | ||
if (this._token) { | ||
return this._token | ||
if (this._token && Date.now() - this._token.timestamp < RESET_TOKEN_INTERVAL_MS) { | ||
return this._token.value | ||
} | ||
@@ -208,3 +205,6 @@ | ||
this._token = token | ||
this._token = { | ||
value: token, | ||
timestamp: Date.now() | ||
} | ||
@@ -220,3 +220,2 @@ return token | ||
this._token = null | ||
return this._getSigningToken() | ||
} | ||
@@ -223,0 +222,0 @@ } |
{ | ||
"name": "apns2", | ||
"version": "9.2.0", | ||
"version": "9.3.0", | ||
"description": "Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.", | ||
@@ -5,0 +5,0 @@ "author": "Andrew Barba <barba@hey.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33147
817