-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Further hardened retry behavior for direct connect auth errors #102
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -471,6 +471,9 @@ export class KumoApi { | |
} else { | ||
this.log.warn('Kumo API: response error from device: %d %s', | ||
response.status, response.statusText); | ||
if(attempt_number < 2 && (await this.checkSecurityToken(true))) { | ||
return this.directRequest(post_data, serial, attempt_number + 1); | ||
} | ||
return null; | ||
} | ||
} catch(error) { | ||
|
@@ -483,8 +486,8 @@ export class KumoApi { | |
return null; | ||
} | ||
|
||
if (!data || data == '{ _api_error: \'device_authentication_error\' }') { | ||
this.log.warn('Kumo API: error direct querying device: %s.', serial); | ||
if(!data || '_api_error' in data) { | ||
this.log.warn('Kumo API: error direct querying device: %s; %s.', serial, data); | ||
Comment on lines
+489
to
+490
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's one more hole I noticed in operation - it appears that api_error responses aren't getting caught by this line and are falling through to the return and being caught by the caller function with an error:
Once again, really tough to test locally. @fjs21 does this look like the correct way to check if the json response contains an _api_error? |
||
if(attempt_number < 2 && (await this.checkSecurityToken(true))) { | ||
return this.directRequest(post_data, serial, attempt_number + 1); | ||
} | ||
|
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.
Extra guard to re-auth for a generic error too. Just to harden this as well
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.
@fjs21 Just pinging to see if you have any feedback for improvement for me on this one! :)
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.
@fjs21 Did you get a chance to look at this PR?