Skip to content

Commit 7b1e8f1

Browse files
committed
fix(github): optimize incremental Convert Jobs query
1 parent 9a23290 commit 7b1e8f1

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

backend/plugins/github/tasks/cicd_job_convertor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type SimpleBranch struct {
5353

5454
func ConvertJobs(taskCtx plugin.SubTaskContext) (err errors.Error) {
5555
db := taskCtx.GetDal()
56+
logger := taskCtx.GetLogger()
5657
data := taskCtx.GetData().(*GithubTaskData)
5758
repoId := data.Options.GithubId
5859

@@ -72,13 +73,13 @@ func ConvertJobs(taskCtx plugin.SubTaskContext) (err errors.Error) {
7273
Input: func(stateManager *api.SubtaskStateManager) (dal.Rows, errors.Error) {
7374
clauses := []dal.Clause{
7475
dal.From(&models.GithubJob{}),
75-
dal.Join("left join _tool_github_runs on _tool_github_runs.id = _tool_github_jobs.run_id and _tool_github_runs.connection_id = _tool_github_jobs.connection_id"),
7676
dal.Where("_tool_github_jobs.repo_id = ? and _tool_github_jobs.connection_id = ?", repoId, data.Options.ConnectionId),
7777
}
7878
if stateManager.IsIncremental() {
7979
since := stateManager.GetSince()
8080
if since != nil {
81-
clauses = append(clauses, dal.Where("_tool_github_runs.github_updated_at >= ?", since))
81+
logger.Info("[Convert Jobs] incremental mode using _tool_github_jobs.updated_at >= %v", since)
82+
clauses = append(clauses, dal.Where("_tool_github_jobs.updated_at >= ?", since))
8283
}
8384
}
8485
return db.Cursor(clauses...)

0 commit comments

Comments
 (0)