Skip to content

Commit

Permalink
fix dbgc
Browse files Browse the repository at this point in the history
  • Loading branch information
haiqingchq committed Dec 3, 2024
1 parent 0a48220 commit efc671b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/tools/pipeline/providers/dbgc/dbgc.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ func (p *provider) doPipelineDatabaseGC(ctx context.Context, req *pb.PipelinePag
}

func needArchive(p spec.Pipeline) bool {
// ensure gc filed is not none
p.EnsureGC()
if p.Status == apistructs.PipelineStatusAnalyzed {
if *p.Extra.GC.DatabaseGC.Analyzed.NeedArchive != false {
return *p.Extra.GC.DatabaseGC.Analyzed.NeedArchive
Expand Down Expand Up @@ -203,6 +205,12 @@ func (p *provider) WaitDBGC(pipelineID uint64, ttl uint64, needArchive bool) {
}

func (p *provider) DoDBGC(pipeline *spec.Pipeline, gcOption apistructs.PipelineGCDBOption) error {
defer func() {
r := recover()
if r != nil {
p.Log.Errorf("dbgc recover from panic, pipeline_id: %d, err: %v", pipeline.PipelineID, r)
}
}()
if gcOption.NeedArchive {
// 归档
_, err := p.dbClient.ArchivePipeline(pipeline.ID)
Expand Down

0 comments on commit efc671b

Please sign in to comment.