@@ -635,21 +635,48 @@ func (a *API) Serve(ctx context.Context) error {
635
635
event .Subscribe (a .warnChan )
636
636
637
637
log .Info ("Initializing internal routines..." )
638
- sdk .GoRoutine ("workflow.ComputeAudit" , func () { workflow .ComputeAudit (ctx , a .DBConnectionFactory .GetDBMap ) })
639
- sdk .GoRoutine ("warning.Start" , func () { warning .Start (ctx , a .DBConnectionFactory .GetDBMap , a .warnChan ) })
640
- sdk .GoRoutine ("queue.Pipelines" , func () { queue .Pipelines (ctx , a .Cache , a .DBConnectionFactory .GetDBMap ) })
641
- sdk .GoRoutine ("pipeline.AWOLPipelineKiller" , func () { pipeline .AWOLPipelineKiller (ctx , a .DBConnectionFactory .GetDBMap , a .Cache ) })
642
- sdk .GoRoutine ("auditCleanerRoutine(ctx" , func () { auditCleanerRoutine (ctx , a .DBConnectionFactory .GetDBMap ) })
643
- sdk .GoRoutine ("metrics.Initialize" , func () { metrics .Initialize (ctx , a .DBConnectionFactory .GetDBMap , a .Config .Name ) })
644
- sdk .GoRoutine ("repositoriesmanager.ReceiveEvents" , func () { repositoriesmanager .ReceiveEvents (ctx , a .DBConnectionFactory .GetDBMap , a .Cache ) })
645
- sdk .GoRoutine ("action.RequirementsCacheLoader" , func () { action .RequirementsCacheLoader (ctx , 5 * time .Second , a .DBConnectionFactory .GetDBMap , a .Cache ) })
646
- sdk .GoRoutine ("hookRecoverer(ctx" , func () { hookRecoverer (ctx , a .DBConnectionFactory .GetDBMap , a .Cache ) })
647
- sdk .GoRoutine ("services.KillDeadServices" , func () { services .KillDeadServices (ctx , a .mustDB ) })
648
- sdk .GoRoutine ("migrate.CleanOldWorkflow" , func () { migrate .CleanOldWorkflow (ctx , a .Cache , a .DBConnectionFactory .GetDBMap , a .Config .URL .API ) })
649
- sdk .GoRoutine ("migrate.KeyMigration" , func () { migrate .KeyMigration (a .Cache , a .DBConnectionFactory .GetDBMap , & sdk.User {Admin : true }) })
650
- sdk .GoRoutine ("broadcast.Initialize" , func () { broadcast .Initialize (ctx , a .DBConnectionFactory .GetDBMap ) })
651
- //sdk.GoRoutine("workflow.RestartAwolJobs", func() { workflow.RestartAwolJobs(ctx, a.Cache, a.DBConnectionFactory.GetDBMap) })
652
- sdk .GoRoutine ("a.serviceAPIHeartbeat(ctx" , func () { a .serviceAPIHeartbeat (ctx ) })
638
+ sdk .GoRoutine (ctx , "workflow.ComputeAudit" , func (ctx context.Context ) {
639
+ workflow .ComputeAudit (ctx , a .DBConnectionFactory .GetDBMap )
640
+ })
641
+ sdk .GoRoutine (ctx , "warning.Start" , func (ctx context.Context ) {
642
+ warning .Start (ctx , a .DBConnectionFactory .GetDBMap , a .warnChan )
643
+ })
644
+ sdk .GoRoutine (ctx , "queue.Pipelines" , func (ctx context.Context ) {
645
+ queue .Pipelines (ctx , a .Cache , a .D
9E81
BConnectionFactory .GetDBMap )
646
+ })
647
+ sdk .GoRoutine (ctx , "pipeline.AWOLPipelineKiller" , func (ctx context.Context ) {
648
+ pipeline .AWOLPipelineKiller (ctx , a .DBConnectionFactory .GetDBMap , a .Cache )
649
+ })
650
+ sdk .GoRoutine (ctx , "auditCleanerRoutine(ctx" , func (ctx context.Context ) {
651
+ auditCleanerRoutine (ctx , a .DBConnectionFactory .GetDBMap )
652
+ })
653
+ sdk .GoRoutine (ctx , "metrics.Initialize" , func (ctx context.Context ) {
654
+ metrics .Initialize (ctx , a .DBConnectionFactory .GetDBMap , a .Config .Name )
655
+ })
656
+ sdk .GoRoutine (ctx , "repositoriesmanager.ReceiveEvents" , func (ctx context.Context ) {
657
+ repositoriesmanager .ReceiveEvents (ctx , a .DBConnectionFactory .GetDBMap , a .Cache )
658
+ })
659
+ sdk .GoRoutine (ctx , "action.RequirementsCacheLoader" , func (ctx context.Context ) {
660
+ action .RequirementsCacheLoader (ctx , 5 * time .Second , a .DBConnectionFactory .GetDBMap , a .Cache )
661
+ })
662
+ sdk .GoRoutine (ctx , "hookRecoverer(ctx" , func (ctx context.Context ) {
663
+ hookRecoverer (ctx , a .DBConnectionFactory .GetDBMap , a .Cache )
664
+ })
665
+ sdk .GoRoutine (ctx , "services.KillDeadServices" , func (ctx context.Context ) {
666
+ services .KillDeadServices (ctx , a .mustDB )
667
+ })
668
+ sdk .GoRoutine (ctx , "migrate.CleanOldWorkflow" , func (ctx context.Context ) {
669
+ migrate .CleanOldWorkflow (ctx , a .Cache , a .DBConnectionFactory .GetDBMap , a .Config .URL .API )
670
+ })
671
+ sdk .GoRoutine (ctx , "migrate.KeyMigration" , func (ctx context.Context ) {
672
+ migrate .KeyMigration (a .Cache , a .DBConnectionFactory .GetDBMap , & sdk.User {Admin : true })
673
+ })
674
+ sdk .GoRoutine (ctx , "broadcast.Initialize" , func (ctx context.Context ) {
675
+ broadcast .Initialize (ctx , a .DBConnectionFactory .GetDBMap )
676
+ })
677
+ sdk .GoRoutine (ctx , "api.serviceAPIHeartbeat" , func (ctx context.Context ) {
678
+ a .serviceAPIHeartbeat (ctx )
679
+ })
653
680
654
681
//Temporary migration code
655
682
go migrate .WorkflowNodeRunArtifacts (a .Cache , a .DBConnectionFactory .GetDBMap )
@@ -683,7 +710,7 @@ func (a *API) Serve(ctx context.Context) error {
683
710
if err := services .InitExternal (a .mustDB , a .Cache , externalServices ); err != nil {
684
711
return fmt .Errorf ("unable to init external service: %v" , err )
685
712
}
686
- sdk .GoRoutine ("pings-external-services" , func () { services .Pings (ctx , a .mustDB , externalServices ) })
713
+ sdk .GoRoutine (ctx , "pings-external-services" , func (ctx context. Context ) { services .Pings (ctx , a .mustDB , externalServices ) })
687
714
688
715
// TODO: to delete after migration
689
716
if os .Getenv ("CDS_MIGRATE_GIT_CLONE" ) == "true" {
@@ -700,12 +727,12 @@ func (a *API) Serve(ctx context.Context) error {
700
727
log .Warning ("⚠ Cron Scheduler is disabled" )
701
728
}
702
729
703
- sdk .GoRoutine ("workflow.Initialize" , func () {
730
+ sdk .GoRoutine (ctx , "workflow.Initialize" , func (ctx context. Context ) {
704
731
workflow .Initialize (ctx , a .DBConnectionFactory .GetDBMap , a .Config .URL .UI , a .Config .DefaultOS , a .Config .DefaultArch )
705
732
})
706
- sdk .GoRoutine ("PushInElasticSearch" , func () { event .PushInElasticSearch (ctx , a .mustDB (), a .Cache ) })
733
+ sdk .GoRoutine (ctx , "PushInElasticSearch" , func (ctx context. Context ) { event .PushInElasticSearch (ctx , a .mustDB (), a .Cache ) })
707
734
metrics .Init (ctx , a .DBConnectionFactory .GetDBMap )
708
- sdk .GoRoutine ("Purge" , func () { purge .Initialize (ctx , a .Cache , a .DBConnectionFactory .GetDBMap ) })
735
+ sdk .GoRoutine (ctx , "Purge" , func (ctx context. Context ) { purge .Initialize (ctx , a .Cache , a .DBConnectionFactory .GetDBMap ) })
709
736
710
737
s := & http.Server {
711
738
Addr : fmt .Sprintf ("%s:%d" , a .Config .HTTP .Addr , a .Config .HTTP .Port ),
0 commit comments