Skip to content

Handle 429 from accountant - #2101

Merged
vkuznecovas merged 1 commit into
masterfrom
accountant-429
Apr 23, 2020
Merged

Handle 429 from accountant#2101
vkuznecovas merged 1 commit into
masterfrom
accountant-429

Conversation

@vkuznecovas

Copy link
Copy Markdown
Contributor

Accountant will now return 429 on request promise and reveal R.

This PR handles them in the following way:

Accountant caller will retry a request promise and reveal R request if a 429 is encountered. Upon encountering a non 429 error, the error will be bubbled straight away.

return res, backoff.Retry(func() error {
err = ac.doRequest(req, &res)
if err != nil {
// if too many requests, retry

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that after 1.5 second lock will be released? Maybe it would be safer and more clear to block in endpoint so it waits until lock is freed inside hermes (the same as simple locks works). In case it can't finish (let's say lock is not freed for some reason) this request will timeout.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is indented to TRY again, not to ensure success. The accountant will lock for very short periods of time(less than 300ms currently). Besides, this error is not critical at all, as you can skip a few reveals/requests just fine.

@vkuznecovas
vkuznecovas merged commit b9f3d24 into master Apr 23, 2020
@vkuznecovas
vkuznecovas deleted the accountant-429 branch April 23, 2020 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants