log key refresh better
This commit is contained in:
parent
429a233974
commit
904513b71a
|
@ -195,11 +195,15 @@ impl TeslaInterface {
|
|||
async fn refresh_keys(&mut self) {
|
||||
// refresh our Tesla (the company's web servers, not the car) access token
|
||||
if Instant::now().duration_since(self.last_refresh) >= KEY_REFRESH_INTERVAL {
|
||||
log::warn!("refreshing keys...");
|
||||
match self.api.refresh().await {
|
||||
Ok(_) => {
|
||||
let now = Instant::now();
|
||||
match self.save_key() {
|
||||
Ok(_) => self.last_refresh = now,
|
||||
Ok(_) => {
|
||||
log::warn!("refreshed keys...");
|
||||
self.last_refresh = now;
|
||||
}
|
||||
Err(e) => error!("error saving auth token: {e:?}"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue