Restart unhealthy (#417) (#441)

This commit is contained in:
Quentin McGaw
2021-05-04 15:36:12 -04:00
committed by GitHub
parent 954e3c70b2
commit 167a0b0b29
4 changed files with 69 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ import (
)
type Server interface {
Run(ctx context.Context, wg *sync.WaitGroup)
Run(ctx context.Context, healthy chan<- bool, wg *sync.WaitGroup)
}
type server struct {
@@ -32,12 +32,12 @@ func NewServer(address string, logger logging.Logger) Server {
}
}
func (s *server) Run(ctx context.Context, wg *sync.WaitGroup) {
func (s *server) Run(ctx context.Context, healthy chan<- bool, wg *sync.WaitGroup) {
defer wg.Done()
internalWg := &sync.WaitGroup{}
internalWg.Add(1)
go s.runHealthcheckLoop(ctx, internalWg)
go s.runHealthcheckLoop(ctx, healthy, internalWg)
server := http.Server{
Addr: s.address,