Pass the correct context to Consumer.Start so that it will actually stop

when singalled
main
Max Ignatenko 2024-03-29 10:15:48 +00:00
parent 567885af60
commit 7c09c37a51
1 changed files with 3 additions and 1 deletions

View File

@ -137,10 +137,12 @@ func runConsumers(ctx context.Context, db *gorm.DB, doneCh chan struct{}) {
c, err := NewConsumer(subCtx, &remote, db) c, err := NewConsumer(subCtx, &remote, db)
if err != nil { if err != nil {
log.Error().Err(err).Msgf("Failed to create a consumer for %q: %s", remote.Host, err) log.Error().Err(err).Msgf("Failed to create a consumer for %q: %s", remote.Host, err)
cancel()
continue continue
} }
if err := c.Start(ctx); err != nil { if err := c.Start(subCtx); err != nil {
log.Error().Err(err).Msgf("Failed ot start a consumer for %q: %s", remote.Host, err) log.Error().Err(err).Msgf("Failed ot start a consumer for %q: %s", remote.Host, err)
cancel()
continue continue
} }