You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2023/01/10 12:04:40 UTC
[incubator-devlake] branch main updated: fix: limit the max rate limit = 200 for gitlab (#4175)
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 7bd9cc1e8 fix: limit the max rate limit = 200 for gitlab (#4175)
7bd9cc1e8 is described below
commit 7bd9cc1e82dd31984caef029387b2ee77e70c3d5
Author: Likyh <ya...@meri.co>
AuthorDate: Tue Jan 10 20:04:35 2023 +0800
fix: limit the max rate limit = 200 for gitlab (#4175)
---
plugins/gitlab/tasks/api_client.go | 11 +++++++----
plugins/gitlab/tasks/pipeline_collector.go | 1 -
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/plugins/gitlab/tasks/api_client.go b/plugins/gitlab/tasks/api_client.go
index 1b7137438..da281300c 100644
--- a/plugins/gitlab/tasks/api_client.go
+++ b/plugins/gitlab/tasks/api_client.go
@@ -19,14 +19,13 @@ package tasks
import (
"fmt"
- "github.com/apache/incubator-devlake/errors"
"net/http"
"strconv"
"time"
- "github.com/apache/incubator-devlake/plugins/gitlab/models"
-
+ "github.com/apache/incubator-devlake/errors"
"github.com/apache/incubator-devlake/plugins/core"
+ "github.com/apache/incubator-devlake/plugins/gitlab/models"
"github.com/apache/incubator-devlake/plugins/helper"
)
@@ -54,7 +53,11 @@ func NewGitlabApiClient(taskCtx core.TaskContext, connection *models.GitlabConne
return 0, 0, errors.Default.Wrap(err, "failed to parse RateLimit-Limit header")
}
// seems like gitlab rate limit is on minute basis
- return rateLimit, 1 * time.Minute, nil
+ if rateLimit > 200 {
+ return 200, 1 * time.Minute, nil
+ } else {
+ return rateLimit, 1 * time.Minute, nil
+ }
},
}
asyncApiClient, err := helper.CreateAsyncApiClient(
diff --git a/plugins/gitlab/tasks/pipeline_collector.go b/plugins/gitlab/tasks/pipeline_collector.go
index a9f3a0a28..9ab0cc03d 100644
--- a/plugins/gitlab/tasks/pipeline_collector.go
+++ b/plugins/gitlab/tasks/pipeline_collector.go
@@ -46,7 +46,6 @@ func CollectApiPipelines(taskCtx core.SubTaskContext) errors.Error {
err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
ApiClient: data.ApiClient,
- Concurrency: 5,
PageSize: 100,
Incremental: incremental,
UrlTemplate: "projects/{{ .Params.ProjectId }}/pipelines",