klesh commented on code in PR #3886:
URL: 
https://github.com/apache/incubator-devlake/pull/3886#discussion_r1045553078


##########
plugins/github/tasks/commit_collector.go:
##########
@@ -43,48 +39,22 @@ var CollectApiCommitsMeta = core.SubTaskMeta{
 }
 
 func CollectApiCommits(taskCtx core.SubTaskContext) errors.Error {
-       db := taskCtx.GetDal()
        data := taskCtx.GetData().(*GithubTaskData)
-
-       since := data.Since
-       incremental := false
-       // user didn't specify a time range to sync, try load from database
-       if since == nil {
-               latestUpdated := &models.GithubCommit{}
-               err := db.All(
-                       &latestUpdated,
-                       dal.Join("left join _tool_github_repo_commits on 
_tool_github_commits.sha = _tool_github_repo_commits.commit_sha"),
-                       dal.Join("left join _tool_github_repos on 
_tool_github_repo_commits.repo_id = _tool_github_repos.github_id"),
-                       dal.Where("_tool_github_repo_commits.repo_id = ? AND 
_tool_github_repo_commits.connection_id = ?", data.Repo.GithubId, 
data.Repo.ConnectionId),
-                       dal.Orderby("committed_date DESC"),
-                       dal.Limit(1),
-               )
-               if err != nil {
-                       return errors.Default.Wrap(err, "failed to get latest 
github commit record")
-               }
-               if latestUpdated.Sha != "" {
-                       since = &latestUpdated.CommittedDate
-                       incremental = true
-               }
+       collectorWithState, err := 
helper.NewApiCollectorWithState(helper.RawDataSubTaskArgs{

Review Comment:
   I think this one should use the old ApiCollector ?



-- 
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