Make channel write non blocking

This commit is contained in:
alexandre.hiltcher@etu.unice.fr
2020-10-21 20:44:36 +02:00
parent b29a76d646
commit cd648ec4b2

View File

@@ -101,10 +101,17 @@ func (service *Service) HandleServiceState(cli *client.Client) (string, error) {
}
if status == UP {
fmt.Printf("- Service %v is up\n", service.name)
fmt.Printf("up %+v\n", time.Now())
if !service.isHandled {
fmt.Printf("not handled %+v\n", time.Now())
go service.stopAfterTimeout(cli)
}
service.time <- service.timeout
fmt.Printf("before write %+v\n", time.Now())
select {
case service.time <- service.timeout:
fmt.Printf("after write %+v\n", time.Now())
default:
}
return "started", nil
} else if status == STARTING {
fmt.Printf("- Service %v is starting\n", service.name)