dosubot[bot] commented on issue #8020:
URL: 
https://github.com/apache/incubator-devlake/issues/8020#issuecomment-2338664256

   <!-- Greeting -->
   Hello @ksarabi-sp! I'm here to help you with any bugs, questions, or 
contributions you have for the project. Let's tackle this issue together!
   
   <!-- Answer -->
   The `issue_collector` gets stuck at the "Collect Issues" task for GitHub 
Enterprise in version v1.0.1-beta9 because the `CollectIssues` function does 
not handle pagination correctly. Specifically, the `BuildQuery` function does 
not properly set the `skipCursor` variable, which is necessary for paginating 
through the issues.
   
   Here is the relevant code snippet:
   
   ```go
   err = apiCollector.InitGraphQLCollector(api.GraphqlCollectorArgs{
       GraphqlClient: data.GraphqlClient,
       PageSize:      10,
       BuildQuery: func(reqData *api.GraphqlRequestData) (interface{}, 
map[string]interface{}, error) {
           query := &GraphqlQueryIssueWrapper{}
           if reqData == nil {
               return query, map[string]interface{}{}, nil
           }
           ownerName := strings.Split(data.Options.Name, "/")
           variables := map[string]interface{}{
               "pageSize":   graphql.Int(reqData.Pager.Size),
               "skipCursor": (*graphql.String)(reqData.Pager.SkipCursor),
               "owner":      graphql.String(ownerName[0]),
               "name":       graphql.String(ownerName[1]),
           }
           return query, variables, nil
       },
       GetPageInfo: func(iQuery interface{}, args *api.GraphqlCollectorArgs) 
(*api.GraphqlQueryPageInfo, error) {
           query := iQuery.(*GraphqlQueryIssueWrapper)
           return query.Repository.IssueList.PageInfo, nil
       },
       ResponseParser: func(queryWrapper any) (messages []json.RawMessage, err 
errors.Error) {
           query := queryWrapper.(*GraphqlQueryIssueWrapper)
           issues := query.Repository.IssueList.Issues
           for _, rawL := range issues {
               if since != nil && since.After(rawL.UpdatedAt) {
                   return messages, api.ErrFinishCollect
               }
               messages = append(messages, errors.Must1(json.Marshal(rawL)))
           }
           return
       },
   })
   ```
   
   The `skipCursor` is not being updated correctly, causing the pagination to 
fail and the task to get stuck 
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github_graphql/tasks/issue_collector.go)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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: dev-unsubscr...@devlake.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to