jibsen-vh commented on code in PR #8341:
URL:
https://github.com/apache/incubator-devlake/pull/8341#discussion_r2003371351
##########
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:
@klesh this brought in a regression it looks like. Something is missing with
regards to migrations - I'm still investigating, but my local deploy of this
didn't do well in the first incremental attempted job.
--
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]