-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix installation token cache issue #442
Fix installation token cache issue #442
Conversation
} | ||
|
||
fn valid_token(&self) -> Option<SecretString> { | ||
self.valid_token_with_buffer(chrono::Duration::seconds(30)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider a token that expires within 30 seconds to be expired by default.
From what I can tell, the expiration is usually set about 1 hour from token mint.
let expiration = token_object | ||
.expires_at | ||
.map(|time| { | ||
DateTime::<Utc>::from_str(&time).map_err(|e| error::Error::Other { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github doesn't document the timezone but I assumed it was UTC. Also checked a couple responses manually and verified that it was UTC.
Thank you for your PR! However I need to check with someone to make sure these aren't overlapping (and different) proposals for the same feature. cc @marcusirgens Is this problem solved by #436 or is it separate? |
@XAMPPRocky Yes, I solve this very similarily in #436, making I'm not opposed to merging this first and working it into my PR, as it's more focused than my "do many things at once"-request, especially considering that #436 needs some clarifications. :) |
@XAMPPRocky sounds like it makes sense to merge so that @marcusirgens can rebase onto this. |
Thank you for your PR! |
My application holds an Installation for an extended period of time (longer than 1 hour). This causes a "Bad credentials" error from Github. This PR introduces a fix that changes the installation token cache to only return a token if it's not expired, forcing Octocrab client to refresh the token appropriately.