Skip to content

Commit

Permalink
add real close method
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaney committed Nov 14, 2024
1 parent 39011d5 commit c375a61
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions waitsensor/waitsensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func init() {

// Config contains names for necessary resources
type Config struct {
DetectorName string `json:"detector_name"`
CameraName string `json:"camera_name"`
ChosenLabels map[string]float64 `json:"chosen_labels"`
CountThresholds map[string]int `json:"count_thresholds"`
PollFrequency float64 `json:"poll_frequency_hz"`
ExtraFields map[string]interface{} `json:"extra_fields"`
DetectorName string `json:"detector_name"`
CameraName string `json:"camera_name"`
ChosenLabels map[string]float64 `json:"chosen_labels"`
CountThresholds map[string]int `json:"count_thresholds"`
PollFrequency float64 `json:"poll_frequency_hz"`
ExtraFields map[string]interface{} `json:"extra_fields"`
}

// Validate validates the config and returns implicit dependencies,
Expand Down Expand Up @@ -113,7 +113,7 @@ type counter struct {
frequency float64
num atomic.Int64
class atomic.Value
extraFields map[string]interface{}
extraFields map[string]interface{}
}

func newWaitSensor(
Expand Down Expand Up @@ -258,6 +258,8 @@ func (cs *counter) Readings(ctx context.Context, extra map[string]interface{}) (

// Close does nothing
func (cs *counter) Close(ctx context.Context) error {
cs.cancelFunc()
cs.activeBackgroundWorkers.Wait()
return nil
}

Expand Down

0 comments on commit c375a61

Please sign in to comment.