error in publisher

This commit is contained in:
mayur.popli
2025-04-02 17:03:00 +05:30
parent 1b97457cc9
commit 522a5c07a2
2 changed files with 8 additions and 2 deletions

View File

@@ -10,5 +10,5 @@ type Publisher interface {
type PublisherProvider interface { type PublisherProvider interface {
// New initializes a new publisher instance with the given configuration. // New initializes a new publisher instance with the given configuration.
New(ctx context.Context, config map[string]string) (Publisher, func(), error) New(ctx context.Context, config map[string]string) (Publisher, func() error, error)
} }

View File

@@ -130,7 +130,13 @@ func (m *Manager) Publisher(ctx context.Context, cfg *Config) (definition.Publis
if err != nil { if err != nil {
return nil, err return nil, err
} }
m.addCloser(closer) if closer != nil {
m.addCloser(func() {
if err := closer(); err != nil {
panic(err)
}
})
}
return p, nil return p, nil
} }