github.com/chenbh/concourse/v6@v6.4.2/atc/gc/pipeline_collector.go (about) 1 package gc 2 3 import ( 4 "context" 5 6 "code.cloudfoundry.org/lager/lagerctx" 7 "github.com/chenbh/concourse/v6/atc/db" 8 ) 9 10 type pipelineCollector struct { 11 pipelineLifecycle db.PipelineLifecycle 12 } 13 14 func NewPipelineCollector(pipelineLifecyle db.PipelineLifecycle) *pipelineCollector { 15 return &pipelineCollector{ 16 pipelineLifecycle: pipelineLifecyle, 17 } 18 } 19 20 func (pc *pipelineCollector) Run(ctx context.Context) error { 21 logger := lagerctx.FromContext(ctx).Session("pipeline-collector") 22 23 logger.Debug("start") 24 defer logger.Debug("done") 25 26 err := pc.pipelineLifecycle.ArchiveAbandonedPipelines() 27 if err != nil { 28 logger.Error("failed-to-automatically-archive-pipelines", err) 29 return err 30 } 31 32 return nil 33 }