This is an automated email from the ASF dual-hosted git repository.

abeizn 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 2a8d4694d fix: update gitlab trigger lint (#6872)
2a8d4694d is described below

commit 2a8d4694d8ba92257bb5a0450125cb597605017b
Author: abeizn <[email protected]>
AuthorDate: Fri Jan 26 10:10:25 2024 +0800

    fix: update gitlab trigger lint (#6872)
    
    * fix: update gitlab trigger lint
    
    * fix: update gitlab trigger lint
---
 .../plugins/gitlab/tasks/trigger_job_collector.go  | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/backend/plugins/gitlab/tasks/trigger_job_collector.go 
b/backend/plugins/gitlab/tasks/trigger_job_collector.go
index 210f0f046..6f31459dd 100644
--- a/backend/plugins/gitlab/tasks/trigger_job_collector.go
+++ b/backend/plugins/gitlab/tasks/trigger_job_collector.go
@@ -18,12 +18,13 @@ limitations under the License.
 package tasks
 
 import (
+       "reflect"
+       "time"
+
        "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/core/plugin"
        helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
-       "reflect"
-       "time"
 )
 
 func init() {
@@ -43,11 +44,19 @@ var CollectApiTriggerJobsMeta = plugin.SubTaskMeta{
 
 func CollectApiTriggerJobs(taskCtx plugin.SubTaskContext) errors.Error {
        rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, 
RAW_TRIGGER_JOB_TABLE)
-       collectorWithState, err := 
helper.NewStatefulApiCollector(*rawDataSubTaskArgs, data.TimeAfter)
+       collectorWithState, err := 
helper.NewStatefulApiCollector(*rawDataSubTaskArgs)
+       if err != nil {
+               return err
+       }
        tickInterval, err := helper.CalcTickInterval(200, 1*time.Minute)
-       incremental := collectorWithState.IsIncremental()
-
+       if err != nil {
+               return err
+       }
        iterator, err := GetAllPipelinesIterator(taskCtx, collectorWithState)
+       if err != nil {
+               return err
+       }
+       incremental := collectorWithState.IsIncremental
 
        err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
                //RawDataSubTaskArgs: *rawDataSubTaskArgs,
@@ -79,8 +88,8 @@ func GetAllPipelinesIterator(taskCtx plugin.SubTaskContext, 
collectorWithState *
                        data.Options.ProjectId, data.Options.ConnectionId,
                ),
        }
-       if collectorWithState.LatestState.LatestSuccessStart != nil {
-               clauses = append(clauses, dal.Where("gitlab_updated_at > ?", 
*collectorWithState.LatestState.LatestSuccessStart))
+       if collectorWithState.IsIncremental && collectorWithState.Since != nil {
+               clauses = append(clauses, dal.Where("gitlab_updated_at > ?", 
collectorWithState.Since))
        }
        // construct the input iterator
        cursor, err := db.Cursor(clauses...)

Reply via email to