Skip to content

Commit

Permalink
fix(gitextractor): update close function (apache#6306)
Browse files Browse the repository at this point in the history
  • Loading branch information
d4x1 committed Oct 24, 2023
1 parent a97089c commit f8c671a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions backend/plugins/gitextractor/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/apache/incubator-devlake/core/errors"
"github.com/apache/incubator-devlake/core/plugin"
helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
"github.com/apache/incubator-devlake/plugins/gitextractor/parser"
"github.com/apache/incubator-devlake/plugins/gitextractor/tasks"
)

Expand Down Expand Up @@ -73,12 +72,14 @@ func (p GitExtractor) PrepareTaskData(taskCtx plugin.TaskContext, options map[st
}

func (p GitExtractor) Close(taskCtx plugin.TaskContext) errors.Error {
if repo, ok := taskCtx.GetData().(*parser.GitRepo); ok {
if err := repo.Close(); err != nil {
return errors.Convert(err)
if taskData, ok := taskCtx.GetData().(*tasks.GitExtractorTaskData); ok {
if taskData.GitRepo != nil {
if err := taskData.GitRepo.Close(); err != nil {
return errors.Convert(err)
}
}
}
return nil
return errors.Default.New("task ctx is not GitExtractorTaskData which is unexpected")
}

func (p GitExtractor) RootPkgPath() string {
Expand Down

0 comments on commit f8c671a

Please sign in to comment.