@@ -545,7 +545,7 @@ func (a *API) Serve(ctx context.Context) error {
545545 }
546546
547547 log .Info (ctx , "Initializing HTTP router" )
548- a .GoRoutines = sdk .NewGoRoutines ()
548+ a .GoRoutines = sdk .NewGoRoutines (ctx )
549549 a .Router = & Router {
550550 Mux : mux .NewRouter (),
551551 Background : ctx ,
@@ -652,12 +652,12 @@ func (a *API) Serve(ctx context.Context) error {
652652 log .Error (ctx , "error while initializing event system: %s" , err )
653653 }
654654
655- a .GoRoutines .Run (ctx , "event.dequeue" , func (ctx context.Context ) {
655+ a .GoRoutines .RunWithRestart (ctx , "event.dequeue" , func (ctx context.Context ) {
656656 event .DequeueEvent (ctx , a .mustDB ())
657657 })
658658
659659 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 ) {
661661 if err := a .listenMaintenance (ctx ); err != nil {
662662 log .Error (ctx , "error while initializing listen maintenance routine: %s" , err )
663663 }
@@ -668,7 +668,7 @@ func (a *API) Serve(ctx context.Context) error {
668668 log .Error (ctx , "error while initializing worker models routine: %s" , err )
669669 }
670670 })
671- a .GoRoutines .Run (ctx , "worker.Initialize" , func (ctx context.Context ) {
671+ a .GoRoutines .RunWithRestart (ctx , "worker.Initialize" , func (ctx context.Context ) {
672672 if err := worker .Initialize (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ), a .Cache ); err != nil {
673673 log .Error (ctx , "error while initializing workers routine: %s" , err )
674674 }
@@ -684,25 +684,25 @@ func (a *API) Serve(ctx context.Context) error {
684684 a .GoRoutines .Run (ctx , "audit.ComputeWorkflowAudit" , func (ctx context.Context ) {
685685 audit .ComputeWorkflowAudit (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ))
686686 })
687- a .GoRoutines .Run (ctx , "auditCleanerRoutine(ctx " , func (ctx context.Context ) {
687+ a .GoRoutines .Run (ctx , "auditCleanerRoutine" , func (ctx context.Context ) {
688688 auditCleanerRoutine (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ))
689689 })
690- a .GoRoutines .Run (ctx , "repositoriesmanager.ReceiveEvents" , func (ctx context.Context ) {
690+ a .GoRoutines .RunWithRestart (ctx , "repositoriesmanager.ReceiveEvents" , func (ctx context.Context ) {
691691 repositoriesmanager .ReceiveEvents (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ), a .Cache )
692692 })
693- a .GoRoutines .Run (ctx , "services.KillDeadServices" , func (ctx context.Context ) {
693+ a .GoRoutines .RunWithRestart (ctx , "services.KillDeadServices" , func (ctx context.Context ) {
694694 services .KillDeadServices (ctx , a .mustDB )
695695 })
696696 a .GoRoutines .Run (ctx , "broadcast.Initialize" , func (ctx context.Context ) {
697697 broadcast .Initialize (ctx , a .DBConnectionFactory .GetDBMap (gorpmapping .Mapper ))
698698 })
699- a .GoRoutines .Run (ctx , "api.serviceAPIHeartbeat" , func (ctx context.Context ) {
699+ a .GoRoutines .RunWithRestart (ctx , "api.serviceAPIHeartbeat" , func (ctx context.Context ) {
700700 a .serviceAPIHeartbeat (ctx )
701701 })
702- a .GoRoutines .Run (ctx , "authentication.SessionCleaner" , func (ctx context.Context ) {
702+ a .GoRoutines .RunWithRestart (ctx , "authentication.SessionCleaner" , func (ctx context.Context ) {
703703 authentication .SessionCleaner (ctx , a .mustDB , 10 * time .Second )
704704 })
705- a .GoRoutines .Run (ctx , "api.WorkflowRunCraft" , func (ctx context.Context ) {
705+ a .GoRoutines .RunWithRestart (ctx , "api.WorkflowRunCraft" , func (ctx context.Context ) {
706706 a .WorkflowRunCraft (ctx , 100 * time .Millisecond )
707707 })
708708
0 commit comments