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


##########
plugins/github/github.go:
##########
@@ -49,9 +50,10 @@ func main() {
 
        cmd.Run = func(cmd *cobra.Command, args []string) {
                runner.DirectRun(cmd, args, PluginEntry, map[string]interface{}{
-                       "connectionId": *connectionId,
-                       "owner":        *owner,
-                       "repo":         *repo,
+                       "connectionId":     *connectionId,

Review Comment:
   should we support scope id as well.



##########
plugins/github/tasks/comment_collector.go:
##########
@@ -40,28 +40,31 @@ func CollectApiComments(taskCtx core.SubTaskContext) 
errors.Error {
        db := taskCtx.GetDal()
        data := taskCtx.GetData().(*GithubTaskData)
 
-       since := data.Since
-       incremental := false
-       var err errors.Error
-       if since == nil {
-               since, incremental, err = calculateSince(data, db)
+       collectorWithState, err := 
helper.NewApiCollectorWithState(helper.RawDataSubTaskArgs{
+               Ctx: taskCtx,
+               Params: GithubApiParams{
+                       ConnectionId: data.Options.ConnectionId,
+                       Owner:        data.Options.Owner,
+                       Repo:         data.Options.Repo,
+               },
+               Table: RAW_COMMENTS_TABLE,
+       }, data.CreatedDateAfter)
+       if err != nil {
+               return err
+       }
+
+       var latestUpdatedTime *time.Time
+       incremental := collectorWithState.CanIncrementCollect()
+       if incremental {
+               latestUpdatedTime, incremental, err = calculateSince(data, db)

Review Comment:
   We should remove the previous complex calculation logic



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