@@ -416,19 +416,18 @@ func (p *Provider) Init(evalCtx of.EvaluationContext) error {
416416 for {
417417 select {
418418 case <- ctx .Done ():
419- close (p .outboundEvents )
420419 return
421420 case e := <- p .inboundEvents :
422421 l := workerLogger .With (
423422 slog .String (MetadataProviderName , e .providerName ),
424423 slog .String (MetadataProviderType , e .ProviderName ),
425424 )
426- l .LogAttrs (context . Background () , slog .LevelDebug , "received event from provider" , slog .String ("event-type" , string (e .EventType )))
425+ l .LogAttrs (ctx , slog .LevelDebug , "received event from provider" , slog .String ("event-type" , string (e .EventType )))
427426 if p .updateProviderStateFromEvent (e ) {
428427 p .outboundEvents <- e .Event
429- l .LogAttrs (context . Background () , slog .LevelDebug , "forwarded state update event" )
428+ l .LogAttrs (ctx , slog .LevelDebug , "forwarded state update event" )
430429 } else {
431- l .LogAttrs (context . Background () , slog .LevelDebug , "total state not updated, inbound event will not be emitted" )
430+ l .LogAttrs (ctx , slog .LevelDebug , "total state not updated, inbound event will not be emitted" )
432431 }
433432 }
434433 }
@@ -552,7 +551,9 @@ func (p *Provider) Shutdown() {
552551 close (p .inboundEvents )
553552 p .logger .LogAttrs (context .Background (), slog .LevelDebug , "starting provider shutdown" )
554553 p .logger .LogAttrs (context .Background (), slog .LevelDebug , "provider shutdown completed" )
554+ close (p .outboundEvents )
555555 p .setStatus (of .NotReadyState )
556+
556557 p .outboundEvents = nil
557558 p .inboundEvents = nil
558559 p .initialized = false
0 commit comments