Skip to content

Commit

Permalink
use reflect.DeepEqual for advisory/observation config equality (#185)
Browse files Browse the repository at this point in the history
Signed-off-by: Caleb Lloyd <caleb@synadia.com>
  • Loading branch information
caleblloyd committed Feb 14, 2024
1 parent 898d712 commit 5df03d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion surveyor/jetstream_advisories.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"io/fs"
"os"
"path/filepath"
"reflect"
"regexp"
"strings"
"sync"
Expand Down Expand Up @@ -665,7 +666,7 @@ func (am *JSAdvisoryManager) Set(config *JSAdvisoryConfig) error {
existingAdv, found := am.listenerMap[config.ID]
am.Unlock()

if found && *config == *existingAdv.config {
if found && reflect.DeepEqual(config, existingAdv.config) {
return nil
}

Expand Down
3 changes: 2 additions & 1 deletion surveyor/observation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"io/fs"
"os"
"path/filepath"
"reflect"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -468,7 +469,7 @@ func (om *ServiceObsManager) Set(config *ServiceObsConfig) error {
existingObs, found := om.listenerMap[config.ID]
om.Unlock()

if found && *config == *existingObs.config {
if found && reflect.DeepEqual(config, existingObs.config) {
return nil
}

Expand Down

0 comments on commit 5df03d9

Please sign in to comment.