From 2d13049b5528d72e783b02127246e7d4d9bfec7f Mon Sep 17 00:00:00 2001 From: Tomi Hakala Date: Sun, 17 Mar 2024 21:25:19 +0200 Subject: [PATCH] refactor(processor): increase dog bark filter scope to 15 minutes and fix log messages --- internal/analysis/processor/dogbarkfilter.go | 2 +- internal/analysis/processor/processor.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/analysis/processor/dogbarkfilter.go b/internal/analysis/processor/dogbarkfilter.go index a140f33b..9a4bff79 100644 --- a/internal/analysis/processor/dogbarkfilter.go +++ b/internal/analysis/processor/dogbarkfilter.go @@ -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 { diff --git a/internal/analysis/processor/processor.go b/internal/analysis/processor/processor.go index 67f4af95..34bb7407 100644 --- a/internal/analysis/processor/processor.go +++ b/internal/analysis/processor/processor.go @@ -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 }