Skip to content

Commit 8773fd3

Browse files
authoredJun 20, 2019
Emit token expiry event 1s earlier
This allows re-request st2 token in advance, instead of trying to get it when it's _already_ expired. Add here HTTP request/response time to communicate token update and it leads to issues and races like StackStorm/st2#4119 StackStorm/hubot-stackstorm#178 (comment) StackStorm/hubot-stackstorm#157
1 parent 46562a2 commit 8773fd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ module.exports = function (opts) {
189189
}
190190
this._expiryTimeout = setTimeout(function () {
191191
this.emit('expiry', token);
192-
}.bind(this), new Date(token.expiry) - new Date());
192+
}.bind(this), new Date(token.expiry) - new Date() - 1000);
193193
return token;
194194
}.bind(this));
195195
}

0 commit comments

Comments
 (0)