external_control.go 410 B

12345678910111213141516171819202122
  1. package supervisor
  2. import (
  3. "time"
  4. )
  5. type ReconnectSignal struct {
  6. // wait this many seconds before re-establish the connection
  7. Delay time.Duration
  8. }
  9. // Error allows us to use ReconnectSignal as a special error to force connection abort
  10. func (r ReconnectSignal) Error() string {
  11. return "reconnect signal"
  12. }
  13. func (r ReconnectSignal) DelayBeforeReconnect() {
  14. if r.Delay > 0 {
  15. time.Sleep(r.Delay)
  16. }
  17. }