mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-12 04:26:51 +00:00
Avoid zombie runners that missed token expiration by a bit (#345)
* if a new runner pod was just scheduled to start up right before a registration expired, it will not get a new registration token and go in an infinite update loop (until #341) kicks in * if registzration tokens got updated a little bit before they actually expired, just starting up pods will way more likely get a working token
This commit is contained in:
@@ -85,7 +85,10 @@ func (c *Client) GetRegistrationToken(ctx context.Context, enterprise, org, repo
|
|||||||
key := getRegistrationKey(org, repo, enterprise)
|
key := getRegistrationKey(org, repo, enterprise)
|
||||||
rt, ok := c.regTokens[key]
|
rt, ok := c.regTokens[key]
|
||||||
|
|
||||||
if ok && rt.GetExpiresAt().After(time.Now()) {
|
// we like to give runners a chance that are just starting up and may miss the expiration date by a bit
|
||||||
|
runnerStartupTimeout := 3 * time.Minute
|
||||||
|
|
||||||
|
if ok && rt.GetExpiresAt().After(time.Now().Add(runnerStartupTimeout)) {
|
||||||
return rt, nil
|
return rt, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user