diff --git a/process/process.go b/process/process.go index 32b28ae2..095f9d5d 100644 --- a/process/process.go +++ b/process/process.go @@ -504,9 +504,6 @@ func (p *process) start() error { // Start the reader go p.reader() - // Wait for the process to finish - go p.waiter() - // Start the stale timeout if enabled if p.stale.timeout != 0 { var ctx context.Context @@ -750,15 +747,18 @@ func (p *process) reader() { p.stale.lock.Unlock() } } + + if err := scanner.Err(); err != nil { + p.logger.Debug().WithError(err).Log("") + } + + // Wait for the process to finish + p.waiter() } // waiter waits for the process to finish. If enabled, the process will // be scheduled for a restart. func (p *process) waiter() { - if p.getState() == stateFinishing { - p.stop(false) - } - if err := p.cmd.Wait(); err != nil { // The process exited abnormally, i.e. the return code is non-zero or a signal // has been raised. diff --git a/restream/restream.go b/restream/restream.go index eb014297..7b252d2a 100644 --- a/restream/restream.go +++ b/restream/restream.go @@ -875,12 +875,6 @@ func (r *restream) UpdateProcess(id string, config *app.Config) error { return ErrUnknownProcess } - // This would require a major version jump - //t.process.CreatedAt = task.process.CreatedAt - t.process.UpdatedAt = time.Now().Unix() - task.parser.TransferReportHistory(t.parser) - t.process.Order = task.process.Order - if id != t.id { _, ok := r.tasks[t.id] if ok { @@ -888,6 +882,8 @@ func (r *restream) UpdateProcess(id string, config *app.Config) error { } } + t.process.Order = task.process.Order + if err := r.stopProcess(id); err != nil { return err } @@ -896,6 +892,11 @@ func (r *restream) UpdateProcess(id string, config *app.Config) error { return err } + // This would require a major version jump + //t.process.CreatedAt = task.process.CreatedAt + t.process.UpdatedAt = time.Now().Unix() + task.parser.TransferReportHistory(t.parser) + r.tasks[t.id] = t // set filesystem cleanup rules