Skip to content

Commit

Permalink
sleep timer logging and secret refresh error and logging changes
Browse files Browse the repository at this point in the history
Signed-off-by: Maxwell Brown <[email protected]>
  • Loading branch information
Galactus22625 committed Jan 30, 2025
1 parent 275309a commit ff1dce8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ private <T> ResponseEntity<T> invokeRestApi(URI uri, Class<T> responseType) thro
log.error(NOISY, "Token expired. We will try to renew the tokens now.");
authConfig.renewCredentials();
} else if (statusCode == HttpStatus.TOO_MANY_REQUESTS) {
log.error(NOISY, "Hitting API rate limit. Backing off with sleep timer.");
log.error(NOISY, "Hitting API rate limit. Backing off with sleep timer for {} seconds.", RETRY_ATTEMPT_SLEEP_TIME.get(retryCount));
} else if (statusCode == HttpStatus.SERVICE_UNAVAILABLE) {
log.error(NOISY, "Service unavailable. Will retry after backing off with sleep timer.");
log.error(NOISY, "Service unavailable. Will retry after backing off with sleep timer for {} seconds.", RETRY_ATTEMPT_SLEEP_TIME.get(retryCount));
} else if (statusCode == HttpStatus.GATEWAY_TIMEOUT) {
log.error(NOISY, "Gateway timeout. Will retry after backing off with sleep timer.");
log.error(NOISY, "Gateway timeout. Will retry after backing off with sleep timer for {} seconds.", RETRY_ATTEMPT_SLEEP_TIME.get(retryCount));
} else {
log.error(NOISY, "Received an unexpected status code {} response from Jira.", statusCode, ex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ public void renewCredentials() {
this.accessToken = (String) oauth2Config.getAccessToken().getValue();
this.refreshToken = (String) oauth2Config.getRefreshToken().getValue();
this.expireTime = Instant.now().plusSeconds(10);
log.info("Access Token and Refresh Token pair is now refreshed. Corresponding Secret store key updated.");
return;
}
throw new RuntimeException("Failed to renew access token message:" + ex.getMessage(), ex);
}
Expand Down

0 comments on commit ff1dce8

Please sign in to comment.