Skip to content

Conversation

kamranayub
Copy link
Owner

@kamranayub kamranayub commented May 25, 2025

Should be able to run tests in GH actions without running into rate limits.

Changes

  • Add new IGDBClient.CreateWithDefaults static helper to create an IGDB client configured with all the defaults
  • Add default Polly API policy to IGDB.ApiPolicy static class and DefaultApiPolicy async policy
  • Add an overload for passing an IAsyncPolicy<HttpResponseMessage> to the client constructor

Notes

  • If the policy is applied by default, it would be a breaking change. Benefit: Just works with IGDB API limits out-of-the-box. Drawback: Unexpected behavior if someone needs complete control over request timing.
  • I could make it optional, so you could still pass the default policy (and tests would always pass it). Benefit: Customizable, backwards-compatible. Drawback: Doesn't "just work" out-of-the-box, more likely to run into 429 exceptions and then accidentally try to workaround in userland code.
  • If I changed it to pass in an HTTP message handler, it could be possible to remove the dependency on Polly from the core library and only do it in tests (but document it so that people can do it on their own) -- Benefit: No dependency on Polly and people can implement a handler however they want. Drawback: Its not built-in so it won't "just work" out of the box. Same drawback as above.

@kamranayub
Copy link
Owner Author

That seems to work, the 2 failures are expected because only my production/local apps have data partnership enabled since I created a new app just for GH actions. I could see about getting access for that too.

@kamranayub kamranayub merged commit 3d5a8bf into master May 26, 2025
1 check passed
@kamranayub kamranayub deleted the test-rate-limiting branch May 26, 2025 05:47
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.

1 participant