Skip to content

Commit

Permalink
add retry hashkey
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Mar 25, 2024
1 parent 0904c09 commit f288b77
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Tedee extends utils.Adapter {
headers: { 'user-agent': this.userAgent },
timeout: 3 * 60 * 1000, //3min client timeout
});
//retry on 405-599 and timeout
//calculate a new header for each retry

axiosRetry(this.requestClient, {
retries: 3,
retryDelay: axiosRetry.exponentialDelay,
Expand All @@ -46,6 +49,7 @@ class Tedee extends utils.Adapter {
} else {
this.log.warn(`Retrying request to ${cfg.url} after ${err.code}`);
}
cfg.headers.api_token = this.hashedAPIKey();
},
retryCondition: (error) => {
return (
Expand Down

0 comments on commit f288b77

Please sign in to comment.