Skip to content

Commit

Permalink
Backport of UI: Add check for renewal time before triggering renew-se…
Browse files Browse the repository at this point in the history
…lf into release/1.8.x (#13956)

* backport of commit b699588

* backport of commit a27fcf3

Co-authored-by: hashishaw <cshaw@hashicorp.com>
  • Loading branch information
1 parent 3c04237 commit ee660f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog/13950.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: trigger token renewal if inactive and half of TTL has passed
```
5 changes: 3 additions & 2 deletions ui/app/services/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,10 @@ export default Service.extend({
},

setLastFetch(timestamp) {
const now = this.now();
this.set('lastFetch', timestamp);
// if expiration was allowed we want to go ahead and renew here
if (this.allowExpiration) {
// if expiration was allowed and we're over half the ttl we want to go ahead and renew here
if (this.allowExpiration && now >= this.renewAfterEpoch) {
this.renew();
}
this.set('allowExpiration', false);
Expand Down

0 comments on commit ee660f3

Please sign in to comment.