mirror of https://bitbucket.org/ausocean/av.git
code cleanup addressing comments on PR
This commit is contained in:
parent
0781cd3c26
commit
be3e74ca43
|
@ -90,13 +90,13 @@ func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
|||
file, err := os.CreateTemp("temp", "video*.h264")
|
||||
if err != nil {
|
||||
tp.log.Error("failed to create temp file", "error", err.Error())
|
||||
return len(p), err
|
||||
return 0, err
|
||||
}
|
||||
defer os.Remove(file.Name())
|
||||
_, err = file.Write(p)
|
||||
n, err := file.Write(p)
|
||||
if err != nil {
|
||||
tp.log.Error("failed to write to temporary file", "error", err.Error())
|
||||
return len(p), err
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Read the file and store each frame.
|
||||
|
@ -118,7 +118,6 @@ func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
|||
tp.contrast = stat.Mean(res.Contrast, nil)
|
||||
tp.sharpness = stat.Mean(res.Sharpness, nil)
|
||||
default:
|
||||
return len(p), nil
|
||||
}
|
||||
return len(p), nil
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ type turbidityProbe struct {
|
|||
sharpness, contrast float64
|
||||
}
|
||||
|
||||
// NewTurbidityProbe returns a empty turbidity probe for CircleCI testing only.
|
||||
// NewTurbidityProbe returns an empty turbidity probe for CircleCI testing only.
|
||||
func NewTurbidityProbe(log logger.Logger, delay time.Duration) (*turbidityProbe, error) {
|
||||
tp := new(turbidityProbe)
|
||||
return tp, nil
|
||||
|
@ -47,7 +47,7 @@ func NewTurbidityProbe(log logger.Logger, delay time.Duration) (*turbidityProbe,
|
|||
|
||||
// Write performs no operation for CircleCI testing only.
|
||||
func (tp *turbidityProbe) Write(p []byte) (int, error) {
|
||||
return len(p), nil
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (tp *turbidityProbe) Close() error {
|
||||
|
|
Loading…
Reference in New Issue