Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
fix: watch ceph cluster only once
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Mar 11, 2022
1 parent ce0230d commit ed64842
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,11 @@ func (c *ceph) run() error {
topic := "ns/" + obj.Name + "/cephclusters"
switch evt.Type {
case watch.Added:
fallthrough
case watch.Modified:
WatchKubeObjects(c.ctx, pubsub, rc.CephV1().CephClusters(obj.Name), topic)
pubsub.AddSub(events, topic)
case watch.Modified:
case watch.Deleted:
pubsub.Unsub(events, "ns/"+obj.Name+"/cephclusters")
pubsub.Unsub(events, topic)
default:
break evtdone
}
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ func main() {

return group.Wait()
}

_ = app.RunContext(ctx, os.Args)
}

Expand Down Expand Up @@ -307,7 +308,7 @@ func newRouter(log logr.Logger, apiTimeout, queryTimeout time.Duration) *mux.Rou
},
}

ctx, cancel := context.WithTimeout(req.Context(), 100*time.Second)
ctx, cancel := context.WithTimeout(req.Context(), queryTimeout)
datach := make(chan runner.Result, 1)
var wg sync.WaitGroup

Expand Down

0 comments on commit ed64842

Please sign in to comment.