Merge pull request #443 from MayurWitsLab/fix/publisher

error function in publisher
This commit is contained in:
Mayur
2025-04-02 22:14:04 +05:30
committed by GitHub
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
} }