plugins: start the go routine before calling Provide

This commit is contained in:
Ludovic Fernandez 2021-12-08 17:08:05 +01:00 committed by GitHub
parent 1c9e4c6050
commit efef7dce4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 7 deletions

View file

@ -153,11 +153,6 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
cfgChan := make(chan json.Marshaler)
err := p.pp.Provide(cfgChan)
if err != nil {
return fmt.Errorf("error from %s: %w", p.name, err)
}
pool.GoCtx(func(ctx context.Context) {
logger := log.FromContext(log.With(ctx, log.Str(log.ProviderName, p.name)))
@ -193,5 +188,10 @@ func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.
}
})
err := p.pp.Provide(cfgChan)
if err != nil {
return fmt.Errorf("error from %s: %w", p.name, err)
}
return nil
}