Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-10-01 13:07:49 +02:00
parent bb373d475b
commit ea525ac1a7

View File

@@ -335,13 +335,13 @@ func (impl *Implm) Run(
apiServerCtx, stopApiServer := context.WithCancel(context.Background()) apiServerCtx, stopApiServer := context.WithCancel(context.Background())
defer stopApiServer() defer stopApiServer()
wg.Add(1) wg.Go(
go func() { func() {
defer wg.Done() if err := impl.runApiServer(apiServerCtx, l, r, tp, serverHandler); err != nil {
if err := impl.runApiServer(apiServerCtx, l, r, tp, serverHandler); err != nil { cancel(fmt.Errorf("api server crashed: %w", err))
cancel(fmt.Errorf("api server crashed: %w", err)) }
} },
}() )
mailerCtx, stopMailer := context.WithCancel(context.Background()) mailerCtx, stopMailer := context.WithCancel(context.Background())
mailer := mailer.NewMailer(pgClient, l, mailer.Config{ mailer := mailer.NewMailer(pgClient, l, mailer.Config{
@@ -353,32 +353,32 @@ func (impl *Implm) Run(
TLSRequired: impl.cfg.Mailer.SMTP.TLSRequired, TLSRequired: impl.cfg.Mailer.SMTP.TLSRequired,
Timeout: time.Second * 10, Timeout: time.Second * 10,
}) })
wg.Add(1) wg.Go(
go func() { func() {
defer wg.Done() if err := mailer.Run(mailerCtx); err != nil {
if err := mailer.Run(mailerCtx); err != nil { cancel(fmt.Errorf("mailer crashed: %w", err))
cancel(fmt.Errorf("mailer crashed: %w", err)) }
} },
}() )
exportJobExporterCtx, stopExportJobExporter := context.WithCancel(context.Background()) exportJobExporterCtx, stopExportJobExporter := context.WithCancel(context.Background())
wg.Add(1) wg.Go(
go func() { func() {
defer wg.Done() if err := impl.runExportJob(exportJobExporterCtx, proboService, l.Named("export-job-exporter")); err != nil {
if err := impl.runExportJob(exportJobExporterCtx, proboService, l.Named("export-job-exporter")); err != nil { cancel(fmt.Errorf("export job exporter crashed: %w", err))
cancel(fmt.Errorf("export job exporter crashed: %w", err)) }
} },
}() )
trustCenterServerCtx, stopTrustCenterServer := context.WithCancel(context.Background()) trustCenterServerCtx, stopTrustCenterServer := context.WithCancel(context.Background())
defer stopTrustCenterServer() defer stopTrustCenterServer()
wg.Add(1) wg.Go(
go func() { func() {
defer wg.Done() if err := impl.runTrustCenterServer(trustCenterServerCtx, l, r, tp, pgClient, serverHandler, acmeService); err != nil {
if err := impl.runTrustCenterServer(trustCenterServerCtx, l, r, tp, pgClient, serverHandler, acmeService); err != nil { cancel(fmt.Errorf("trust center server crashed: %w", err))
cancel(fmt.Errorf("trust center server crashed: %w", err)) }
} },
}() )
<-ctx.Done() <-ctx.Done()