diff --git a/cmd/rv/main.go b/cmd/rv/main.go index 88b6b591..bb5666fc 100644 --- a/cmd/rv/main.go +++ b/cmd/rv/main.go @@ -195,15 +195,17 @@ func (tp *turbidityProbe) Write(p []byte) (int, error) { tp.log.Log(logger.Debug, "found frames", "frames", len(imgs)) // Process video data to get saturation and contrast scores. - startTime := time.Now() - res, err := tp.ts.Evaluate(imgs) - tp.log.Log(logger.Debug, "finished evaluation", "total duration (sec)", time.Since(startTime).Seconds()) - if err != nil { - tp.log.Error("evaluate failed", "error", err.Error()) - return len(p), err - } - tp.contrast = stat.Mean(res.Contrast, nil) - tp.sharpness = stat.Mean(res.Sharpness, nil) + go func() { + startTime := time.Now() + res, err := tp.ts.Evaluate(imgs) + if err != nil { + tp.log.Error("evaluate failed", "error", err.Error()) + } else { + tp.log.Log(logger.Debug, "finished evaluation", "total duration (sec)", time.Since(startTime).Seconds()) + tp.contrast = stat.Mean(res.Contrast, nil) + tp.sharpness = stat.Mean(res.Sharpness, nil) + } + }() default: return len(p), nil }