scala-steward icon indicating copy to clipboard operation
scala-steward copied to clipboard

Fixed retry and duplicated replacements

Open Seetaramayya opened this issue 2 years ago • 4 comments

For good amount of time our scala-steward jobs are failing. Following changes fixed in our case, so creating the PR, might be useful port the changes to the main repo.

I hope this PR address the issue https://github.com/scala-steward-org/scala-steward/issues/2934

New Retry logic

  • If Retry-After header present, then use the header value to retry (this was there before)
  • otherwise retry request after time specified by X-Ratelimit-Reset header. Header value is UTC epoch seconds. Here I took some assumptions
    • if the difference between header value and current UTC epoch seconds is more than 60 seconds then I retry after 60 seconds. That means max wait time would be 60 seconds.
    • if the difference is negative then I retry after 1 second. That means min wait time is 1 second
  • if neither of the headers present, wait 1.second

Here is the github suggested best-practices

image

~~Another issue~~

~~If there are duplicated replacements then the job was failing with StringIndexOutOfBoundsException. Added unit test to verify the behaviour~~.

Seetaramayya avatar Mar 20 '23 13:03 Seetaramayya

Another issue

This deserves its own PR. I would also prefer to have a test for that in RewriteTest instead of in EditAlgTest.

fthomas avatar Mar 20 '23 18:03 fthomas

Another PR crated to address the other issue https://github.com/scala-steward-org/scala-steward/pull/3016

Seetaramayya avatar Mar 20 '23 20:03 Seetaramayya

Are you going to merge this PR?

Seetaramayya avatar May 24 '23 09:05 Seetaramayya

In order to make this PR mergeable, you must resolve the conflicts first.

odisseus avatar Nov 20 '23 02:11 odisseus