diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-12-17 12:16:54 +0800 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2019-12-16 23:16:54 -0500 |
commit | ffc904b1e0635d17e55b5fbdea4e18832ee2276d (patch) | |
tree | 209691d128fb2e23476e0b1ac67c51c6f5b693de /routers/api | |
parent | d1a49977b089afefc40172711d02eb795d2234de (diff) | |
download | gitea-ffc904b1e0635d17e55b5fbdea4e18832ee2276d.tar.gz gitea-ffc904b1e0635d17e55b5fbdea4e18832ee2276d.zip |
Sleep longer if request speed is over github limitation (#9335)
* Sleep longer if request speed is over github limitation
* improve code
* remove unused code
* fix lint
* Use github's rate limit remain value to determine how long to sleep
* Save reset time when finished github api request
* fix bug
* fix lint
* Add context.Context for sleep
* fix test
* improve code
* fix bug and lint
* fix import order
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/repo/repo.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index cab0fc07e0..be226c3438 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -18,6 +18,7 @@ import ( "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/convert" "code.gitea.io/gitea/modules/git" + "code.gitea.io/gitea/modules/graceful" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/migrations" "code.gitea.io/gitea/modules/notification" @@ -481,7 +482,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { } }() - if _, err = migrations.MigrateRepository(ctx.User, ctxUser.Name, opts); err != nil { + if _, err = migrations.MigrateRepository(graceful.GetManager().HammerContext(), ctx.User, ctxUser.Name, opts); err != nil { handleMigrateError(ctx, ctxUser, remoteAddr, err) return } |