github-api icon indicating copy to clipboard operation
github-api copied to clipboard

AbuseLimitHandler does not handle scenarios where the local time is not synchronized with GitHub server time

Open bitwiseman opened this issue 1 year ago • 0 comments

From this comment on #1895 :

GitHubClient has a method to get Date (or Instant). https://github.com/hub4j/github-api/blob/main/src/main/java/org/kohsuke/github/GitHubClient.java#L916

Unfortunately, diff from local machine time is not reliable. The local machine may not be synchronized with the server time. We have to use the diff from the response time. https://github.com/hub4j/github-api/blob/main/src/main/java/org/kohsuke/github/GHRateLimit.java#L543-L571

However, this PR is a huge step forward and I'd rather have this less than perfect code added than wait for the next release.

This is the code that need updating:

https://github.com/hub4j/github-api/blob/314917eabf9762e0d62d52f3ae68bc9ff6ba7ed5/src/main/java/org/kohsuke/github/AbuseLimitHandler.java#L116-L122

bitwiseman avatar Aug 19 '24 03:08 bitwiseman