warren830 commented on code in PR #4269:
URL:
https://github.com/apache/incubator-devlake/pull/4269#discussion_r1090290732
##########
backend/generator/template/plugin/tasks/api_collector.go-template:
##########
@@ -34,21 +34,19 @@ var _ core.SubTaskEntryPoint = Collect{{ .CollectorDataName
}}
func Collect{{ .CollectorDataName }}(taskCtx core.SubTaskContext) errors.Error
{
data := taskCtx.GetData().(*{{ .PluginName }}TaskData)
- iterator, err := helper.NewDateIterator(365)
+ rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx,
RAW_PROJECTS_TABLE)
+ logger := taskCtx.GetLogger()
+
+ collectorWithState, err :=
helper.NewApiCollectorWithState(*rawDataSubTaskArgs, data.CreatedDateAfter)
if err != nil {
return err
}
+ incremental := collectorWithState.IsIncremental()
- collector, err := helper.NewApiCollector(helper.ApiCollectorArgs{
- RawDataSubTaskArgs: helper.RawDataSubTaskArgs{
- Ctx: taskCtx,
- Params: {{ .PluginName }}ApiParams{
- },
- Table: RAW_{{ .COLLECTOR_DATA_NAME }}_TABLE,
- },
+ err = collectorWithState.InitCollector(helper.ApiCollectorArgs{
+ Incremental: incremental,
ApiClient: data.ApiClient,
- Incremental: false,
- Input: iterator,
+ PageSize: 100,
Review Comment:
fixed
##########
backend/generator/template/plugin/tasks/api_collector.go-template:
##########
@@ -34,21 +34,19 @@ var _ core.SubTaskEntryPoint = Collect{{ .CollectorDataName
}}
func Collect{{ .CollectorDataName }}(taskCtx core.SubTaskContext) errors.Error
{
data := taskCtx.GetData().(*{{ .PluginName }}TaskData)
- iterator, err := helper.NewDateIterator(365)
+ rawDataSubTaskArgs, data := CreateRawDataSubTaskArgs(taskCtx,
RAW_PROJECTS_TABLE)
Review Comment:
fixed
##########
backend/generator/template/plugin/impl/impl_complete_plugin.go-template:
##########
@@ -76,11 +76,22 @@ func (p {{ .PluginName }}) PrepareTaskData(taskCtx
plugin.TaskContext, options m
if err != nil {
return nil, errors.Default.Wrap(err, "unable to get {{ .PluginName }}
API client instance")
}
-
- return &tasks.{{ .PluginName }}TaskData{
- Options: op,
- ApiClient: apiClient,
- }, nil
+ taskData := &tasks.SonarqubeTaskData{
Review Comment:
fixed
--
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]