File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,8 +89,14 @@ func Authenticate() {
8989// CheckReauth checks if we have not yet authenticated, or need to authenticate within the next 15 minutes
9090func CheckReauth () {
9191 for {
92- if CodeArtifactAuthInfo .AuthorizationToken == "" || time .Now ().Sub (CodeArtifactAuthInfo .LastAuth ) > 45 * time .Minute {
93- log .Printf ("%d minutes until the CodeArtifact token expires, attempting a reauth." , time .Now ().Sub (CodeArtifactAuthInfo .LastAuth )/ time .Minute )
92+ timeSince := time .Since (CodeArtifactAuthInfo .LastAuth ).Minutes ()
93+ // Panic and shut down the proxy if we couldn't reauthenticate within the 15 minute window for some reason.
94+ if timeSince > float64 (60 ) {
95+ log .Panic ("Was unable to re-authenticate prior to our token expiring, shutting down proxty..." )
96+ }
97+
98+ if CodeArtifactAuthInfo .AuthorizationToken == "" || timeSince > float64 (45 ) {
99+ log .Printf ("%f minutes until the CodeArtifact token expires, attempting a reauth." , 60 - timeSince )
94100 Authenticate ()
95101 }
96102 // Sleep for 15 seconds for the next check
You can’t perform that action at this time.
0 commit comments