mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-02-03 20:51:07 -05:00
This is a successor to #10805, which simply did not work. It is also much simpler and basically a one line change to enable an existing feature in [go-github](https://github.com/google/go-github). Fixes #10845 With this fix and #10798 in place, a migration of a repo with ~3K issues and ~1.3k pull requests finally completed successfully. ## Patch We use SleepUntilPrimaryRateLimitResetWhenRateLimited to instruct the go-github code to wait until the retry time and retry the request when the primary rate limit gets hit. ## Test case TestGitHubDownloadRepo() has been modified such that 403 rate limit errors are injected every 7 requests with a retry time of one second, resulting in the rate limit condition being hit twice with the current tests. The test case confirms that the migration code itself is in fact unaffected by the rate limit being hit. ## Scope This change does not affect secondary rate limits. If the server is restarted during the wait for the rate limit refresh, the migration likely still fails when retried, because inserts for already present database objects will be attempted. This approach effectively puts the task's goroutine to sleep until the retry time, which implies that the respective resources stay allocated. A better approach might be to add the necessary infrastructure to support restarts of migration tasks at a later time, but this is much more involved, because the migration state would need to be saved and/or re-created based on already pulled data. This would also require adding support for database upserts. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10846 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Nils Goroll <nils.goroll@uplex.de> Co-committed-by: Nils Goroll <nils.goroll@uplex.de> |
||
|---|---|---|
| .. | ||
| emoji.json | ||
| favicon.svg | ||
| go-licenses.json | ||
| logo.svg | ||