cake-contrib / Cake.AddinDiscoverer

Tool to aid with discovering information about Cake Addins
MIT License
5 stars 6 forks source link

Improve abuse detection protection #171

Closed Jericho closed 3 years ago

Jericho commented 3 years ago

We have logic that tries to prevent triggering GitHub's abuse detection but I am still noticing Octokit.AbuseException: You have triggered an abuse detection mechanism and have been temporarily blocked from content creation. Please retry your request again later. in the build log from time to time.

What particularly bothers me is that sometimes we raise an issue and commit a change but the corresponding PR does not get created because of this exception.

This logic needs to be improved to further reduce likelihood of the AbuseException and also to ensure that this exception does not occur in the middle of "commit+issue+PR"

Jericho commented 3 years ago

I have increased how often we check for remaining API calls, but it won't solve all issues because GitHub has other ways to prevent people from abusing their system which I don't think they have documented. For instance, I believe they check how quickly you are committing changes and raising issues and submitting PRs. My code is peppered with 'Task.Wait' to try to minimize the likelihood of this happening but I can't guarantee it won't happen.

augustoproiete commented 3 years ago

The Task.Delay(1000) will probably help a lot with the abuse detection. You might want to take it up a notch and do the wait at random times in the hopes that GitHub thinks it's a random process driven by a user rather than 100% robot.

using System.Security.Cryptography;
// ...

await Task.Delay(RandomNumberGenerator.GetInt32(600, 2000));