add subscribe for node events
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
aa0c2abf84
commit
5dace354b7
1 changed files with 12 additions and 0 deletions
12
agent.go
12
agent.go
|
@ -50,3 +50,15 @@ func NewAgent(cfg *Config) (*Agent, error) {
|
||||||
grpcServer: grpcServer,
|
grpcServer: grpcServer,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subscribe subscribes to the node event channel
|
||||||
|
func (a *Agent) Subscribe(ch chan *NodeEvent) {
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case evt := <-a.nodeEventChan:
|
||||||
|
ch <- evt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue