Skip to content

Commit

Permalink
refactor(processor): increase dog bark filter scope to 15 minutes and…
Browse files Browse the repository at this point in the history
… fix log messages
  • Loading branch information
tphakala committed Mar 17, 2024
1 parent 94b19e7 commit 2d13049
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/analysis/processor/dogbarkfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// Assuming a predefined time limit for filtering detections after a dog bark.
const DogBarkFilterTimeLimit = 300 * time.Second
const DogBarkFilterTimeLimit = 15 * time.Minute

// DogBarkFilter contains a list of species to be filtered within the time limit after a dog bark.
type DogBarkFilter struct {
Expand Down
5 changes: 2 additions & 3 deletions internal/analysis/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,16 @@ func (p *Processor) pendingDetectionsFlusher() {

// Check dog bark filter
if p.Settings.Realtime.DogBarkFilter.Enabled {
log.Println("Checking dog bark filter")
log.Printf("Last dog detection: %s\n", p.LastDogDetection)
// Check against common name
if p.DogBarkFilter.Check(item.Detection.Note.CommonName, p.LastDogDetection) {
log.Printf("Filtering out %s due to recent dog bark\n", item.Detection.Note.CommonName)
log.Printf("Discarding detection of %s due to recent dog bark\n", item.Detection.Note.CommonName)
delete(PendingDetections, species)
continue
}
// Check against scientific name
if p.DogBarkFilter.Check(item.Detection.Note.ScientificName, p.LastDogDetection) {
log.Printf("Filtering out %s due to recent dog bark\n", item.Detection.Note.CommonName)
log.Printf("Discarding detection of %s due to recent dog bark\n", item.Detection.Note.CommonName)
delete(PendingDetections, species)
continue
}
Expand Down

0 comments on commit 2d13049

Please sign in to comment.