Skip to content

Commit

Permalink
updating locks
Browse files Browse the repository at this point in the history
Signed-off-by: Jaydip Gabani <[email protected]>
  • Loading branch information
JaydipGabani committed Nov 27, 2024
1 parent b775a7a commit 52a9d5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/pubsub/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func NewSystem() *System {
}

func (s *System) Publish(_ context.Context, connection string, topic string, msg interface{}) error {
s.mux.RLock()
defer s.mux.RUnlock()
s.mux.Lock()
defer s.mux.Unlock()
if len(s.connections) > 0 {
if c, ok := s.connections[connection]; ok {
return c.Publish(context.Background(), msg, topic)
Expand Down
2 changes: 1 addition & 1 deletion test/pubsub/pod_must_have_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ spec:
match:
kinds:
- apiGroups: [ "" ]
kinds: [ "Pod" ]
kinds: [ "Namespace" ]
parameters:
labels: [ "test" ]

0 comments on commit 52a9d5d

Please sign in to comment.