Skip to content

Commit

Permalink
refactor: CollectAccounts now uses simple ApiCollector (#8067) (#8161)
Browse files Browse the repository at this point in the history
Co-authored-by: Josip Stojak <Josip.Stojak@infobip.com>
  • Loading branch information
sstojak1 and Josip Stojak authored Oct 25, 2024
1 parent 36fb7dc commit 7cf1a60
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions backend/plugins/sonarqube/tasks/accounts_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ func CollectAccounts(taskCtx plugin.SubTaskContext) errors.Error {
logger := taskCtx.GetLogger()
logger.Info("collect accounts")
rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx, RAW_ACCOUNTS_TABLE)
collectorWithState, err := helper.NewStatefulApiCollector(*rawDataSubTaskArgs)
if err != nil {
return err
}
if err := collectorWithState.InitCollector(helper.ApiCollectorArgs{
collector, err := helper.NewApiCollector(helper.ApiCollectorArgs{
RawDataSubTaskArgs: *rawDataSubTaskArgs,
ApiClient: data.ApiClient,
PageSize: 100,
Expand All @@ -59,11 +55,12 @@ func CollectAccounts(taskCtx plugin.SubTaskContext) errors.Error {
err := helper.UnmarshalResponse(res, &resData)
return resData.Data, err
},
}); err != nil {
})
if err != nil {
return err
}

return collectorWithState.Execute()
return collector.Execute()
}

var CollectAccountsMeta = plugin.SubTaskMeta{
Expand Down

0 comments on commit 7cf1a60

Please sign in to comment.