v0.2.2 minor fixes

This commit is contained in:
2025-07-11 21:47:22 -04:00
parent 08c4df4d65
commit 66f9a92592
3 changed files with 12 additions and 7 deletions

View File

@ -144,13 +144,23 @@ func (s *Service) wirePipeline(p *Pipeline) {
defer p.wg.Done()
// Panic recovery to prevent single source from crashing pipeline
// TODO: check if failed pipeline is properly shut down
defer func() {
if r := recover(); r != nil {
s.logger.Error("msg", "Panic in pipeline processing",
"pipeline", p.Name,
"source", source.GetStats().Type,
"panic", r)
// Ensure failed pipelines don't leave resources hanging
go func() {
s.logger.Warn("msg", "Shutting down pipeline due to panic",
"pipeline", p.Name)
if err := s.RemovePipeline(p.Name); err != nil {
s.logger.Error("msg", "Failed to remove panicked pipeline",
"pipeline", p.Name,
"error", err)
}
}()
}
}()