Skip to content

Commit

Permalink
sensors: respect ctx in ListTracingPolicies
Browse files Browse the repository at this point in the history
We should also do the same in the other operations, but we leave that as
a followup.

Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
  • Loading branch information
kkourt committed Apr 2, 2024
1 parent e26b385 commit 33b4014
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/sensors/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,15 @@ func (h *Manager) ListTracingPolicies(ctx context.Context) (*tetragon.ListTracin
retChan: retc,
}

h.sensorCtl <- op
err := <-retc
return op.result, err
select {
case h.sensorCtl <- op:
err := <-retc
return op.result, err

case <-ctx.Done():
return nil, ctx.Err()
}

}

func (h *Manager) RemoveSensor(ctx context.Context, sensorName string) error {
Expand Down

0 comments on commit 33b4014

Please sign in to comment.