Skip to content

Commit

Permalink
fix: remove mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsinai committed Jun 27, 2024
1 parent 1a103d5 commit 103181b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pkg/jq/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ import (
"os"
"reflect"
"strings"
"sync"

"github.com/itchyny/gojq"
"github.com/port-labs/port-k8s-exporter/pkg/goutils"
"k8s.io/klog/v2"
)

var mutex = &sync.Mutex{}

func runJQQuery(jqQuery string, obj interface{}) (interface{}, error) {
query, err := gojq.Parse(jqQuery)
if err != nil {
Expand All @@ -30,10 +27,8 @@ func runJQQuery(jqQuery string, obj interface{}) (interface{}, error) {
klog.Warningf("failed to compile jq query: %s", jqQuery)
return nil, err
}
mutex.Lock()
deepClone := goutils.DeepCopy(obj)
queryRes, ok := code.Run(deepClone).Next()
mutex.Unlock()

if !ok {
return nil, fmt.Errorf("query should return at least one value")
Expand Down

0 comments on commit 103181b

Please sign in to comment.