mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Auth: Prevent scheduled token rotation jobs with large delay from rolling back to 1 ms (#93242)
Auth: prevent scheduled token rotation jobs with large delay from rolling back to 1 ms
This commit is contained in:
parent
03c48844dd
commit
04d9fa04a7
@ -197,9 +197,8 @@ export class ContextSrv {
|
||||
// to distribute the scheduling of the job. For now this can be between 1 and 20 seconds
|
||||
const expiresWithDistribution = expires - Math.floor(Math.random() * (20 - 1) + 1);
|
||||
|
||||
// nextRun is when the job should be scheduled for
|
||||
let nextRun = expiresWithDistribution * 1000 - Date.now();
|
||||
|
||||
// nextRun is when the job should be scheduled for in ms. setTimeout ms has a max value of 2147483647.
|
||||
let nextRun = Math.min(expiresWithDistribution * 1000 - Date.now(), 2147483647);
|
||||
// @ts-ignore
|
||||
this.tokenRotationJobId = setTimeout(() => {
|
||||
// if we have a new expiry time from the expiry cookie another tab have already performed the rotation
|
||||
|
Loading…
Reference in New Issue
Block a user