Nickcw6 commented on code in PR #8341:
URL: 
https://github.com/apache/incubator-devlake/pull/8341#discussion_r2003915928


##########
backend/plugins/circleci/tasks/job_collector.go:
##########
@@ -43,30 +46,68 @@ func CollectJobs(taskCtx plugin.SubTaskContext) 
errors.Error {
        logger := taskCtx.GetLogger()
        logger.Info("collect jobs")
 
-       clauses := []dal.Clause{
-               dal.Select("id, pipeline_id"),
-               dal.From(&models.CircleciWorkflow{}),
-               dal.Where("_tool_circleci_workflows.connection_id = ? and 
_tool_circleci_workflows.project_slug = ? ", data.Options.ConnectionId, 
data.Options.ProjectSlug),
-       }
+       collector, err := 
api.NewStatefulApiCollectorForFinalizableEntity(api.FinalizableApiCollectorArgs{
+               RawDataSubTaskArgs: *rawDataSubTaskArgs,
+               ApiClient:          data.ApiClient,
+               CollectNewRecordsByList: api.FinalizableApiCollectorListArgs{
+                       PageSize:              int(data.Options.PageSize),
+                       GetNextPageCustomData: ExtractNextPageToken,
+                       BuildInputIterator: func(isIncremental bool, 
createdAfter *time.Time) (api.Iterator, errors.Error) {
+                               clauses := []dal.Clause{
+                                       dal.Select("id, pipeline_id"), // 
pipeline_id not on individual job response but required for result
+                                       dal.From(&models.CircleciWorkflow{}),
+                                       dal.Where("connection_id = ? and 
project_slug = ?", data.Options.ConnectionId, data.Options.ProjectSlug),
+                               }
 
-       db := taskCtx.GetDal()
-       cursor, err := db.Cursor(clauses...)
-       if err != nil {
-               return err
-       }
-       iterator, err := api.NewDalCursorIterator(db, cursor, 
reflect.TypeOf(models.CircleciWorkflow{}))
-       if err != nil {
-               return err
-       }
+                               if isIncremental {
+                                       clauses = append(clauses, 
dal.Where("created_date > ?", createdAfter))
+                               }

Review Comment:
   @jibsen-vh I think it's because the changes from this PR were not 
cherrypicked: https://github.com/apache/incubator-devlake/pull/7757 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to