Conditional Timeout
问题 I have some code, there are 3 timers, GracefulExecutionTimeout - total running time WaitTimeout - time to initial wait for first message IdleTimeout - time to wait for subsequent messages If any of the timers are reached the app should cleanly exit. I have it working below msgs := make(chan string) go func() { time.Sleep(time.Second) msgs <- "test" }() // graceful max execution time gracefulMaxTimeout := time.Second * time.Duration(10) gracefulMaxTimer := time.NewTimer(gracefulMaxTimeout) //