mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-21 10:18:50 +02:00
Add comment
This commit is contained in:
parent
183f746158
commit
c94c949173
@ -23,6 +23,7 @@ type Receiver struct {
|
|||||||
live bool
|
live bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewReceiver creates a new healthcheck receiver and start the timer in the background
|
||||||
func NewReceiver() *Receiver {
|
func NewReceiver() *Receiver {
|
||||||
ctx, ctxCancel := context.WithCancel(context.Background())
|
ctx, ctxCancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
@ -37,6 +38,7 @@ func NewReceiver() *Receiver {
|
|||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Heartbeat acknowledge the heartbeat has been received
|
||||||
func (r *Receiver) Heartbeat() {
|
func (r *Receiver) Heartbeat() {
|
||||||
select {
|
select {
|
||||||
case r.heartbeat <- struct{}{}:
|
case r.heartbeat <- struct{}{}:
|
||||||
@ -44,6 +46,7 @@ func (r *Receiver) Heartbeat() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop check the timeout and do not send new notifications
|
||||||
func (r *Receiver) Stop() {
|
func (r *Receiver) Stop() {
|
||||||
r.ctxCancel()
|
r.ctxCancel()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user