@@ -545,7 +545,7 @@ func (a *API) Serve(ctx context.Context) error {
545
545
}
546
546
547
547
log .Info (ctx , "Initializing HTTP router" )
548
- a .GoRoutines = sdk .NewGoRoutines ()
548
+ a .GoRoutines = sdk .NewGoRoutines (ctx )
549
549
a .Router = & Router {
550
550
Mux : mux .NewRouter (),
551
551
Background : ctx ,
@@ -652,12 +652,12 @@ func (a *API) Serve(ctx context.Context) error {
652
652
log .Error (ctx , "error while initializing event system: %s" , err )
653
653
}
654
654
655
- a .GoRoutines .Run (ctx , "event.dequeue" , func (ctx context.Context ) {
655
+ a .GoRoutines .RunWithRestart (ctx , "event.dequeue" , func (ctx context.Context ) {
656
656
event .DequeueEvent (ctx , a .mustDB ())
657
657
})
658
658
659
659
log .Info (ctx , "Initializing internal routines..." )
660
- a .GoRoutines .Run (ctx , "maintenance.Subscribe" , func (ctx context.Context ) {
660
+ a .GoRoutines .RunWithRestart (ctx , "maintenance.Subscribe" , func (ctx context.Context ) {
661
661
if err := a .listenMaintenance (ctx ); err != nil {
662
662
log .Error (ctx , "error while initializing listen maintenance routine: %s" , err )
663
663
}
@@ -668,7 +668,7 @@ func (a *API) Serve(ctx context.Context) error {
668
668
log .Error (ctx , "error while initializing worker models routine: %s" , err )
669
669
}
670
670
})
671
- a .GoRoutines .Run (ctx , "worker.Initialize" , func (ctx context.Context ) {
671
+ a .GoRoutines .RunWithRestart (ctx , "worker.Initialize" , func (ctx context.Context ) {
672
672
if err := worker .Initialize (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ), a .Cache ); err != nil {
673
673
log .Error (ctx , "error while initializing workers routine: %s" , err )
674
674
}
@@ -684,25 +684,25 @@ func (a *API) Serve(ctx context.Context) error {
684
684
a .GoRoutines .Run (ctx , "audit.ComputeWorkflowAudit" , func (ctx context.Context ) {
685
685
audit .ComputeWorkflowAudit (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ))
686
686
})
687
- a .GoRoutines .Run (ctx , "auditCleanerRoutine(ctx " , func (ctx context.Context ) {
687
+ a .GoRoutines .Run (ctx , "auditCleanerRoutine" , func (ctx context.Context ) {
688
688
auditCleanerRoutine (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ))
689
689
})
690
- a .GoRoutines .Run (ctx , "repositoriesmanager.ReceiveEvents" , func (ctx context.Context ) {
690
+ a .GoRoutines .RunWithRestart (ctx , "repositoriesmanager.ReceiveEvents" , func (ctx context.Context ) {
691
691
repositoriesmanager .ReceiveEvents (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ), a .Cache )
692
692
})
693
- a .GoRoutines .Run (ctx , "services.KillDeadServices" , func (ctx context.Context ) {
693
+ a .GoRoutines .RunWithRestart (ctx , "services.KillDeadServices" , func (ctx context.Context ) {
694
694
services .KillDeadServices (ctx , a .mustDB )
695
695
})
696
696
a .GoRoutines .Run (ctx , "broadcast.Initialize" , func (ctx context.Context ) {
697
697
broadcast .Initialize (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ))
698
698
})
699
- a .GoRoutines .Run (ctx , "api.serviceAPIHeartbeat" , func (ctx context.Context ) {
699
+ a .GoRoutines .RunWithRestart (ctx , "api.serviceAPIHeartbeat" , func (ctx context.Context ) {
700
700
a .serviceAPIHeartbeat (ctx )
701
701
})
702
- a .GoRoutines .Run (ctx , "authentication.SessionCleaner" , func (ctx context.Context ) {
702
+ a .GoRoutines .RunWithRestart (ctx , "authentication.SessionCleaner" , func (ctx context.Context ) {
703
703
authentication .SessionCleaner (ctx , a .mustDB , 10 * time .Second )
704
704
})
705
- a .GoRoutines .Run (ctx , "api.WorkflowRunCraft" , func (ctx context.Context ) {
705
+ a .GoRoutines .RunWithRestart (ctx , "api.WorkflowRunCraft" , func (ctx context.Context ) {
706
706
a .WorkflowRunCraft (ctx , 100 * time .Millisecond )
707
707
})
708
708
0 commit comments