Open NeoZephyr opened 2 years ago
func (s *Service) consume() { defer func() { if x := recover(); x != nil { go s.consume() } }() for { f := <-s.tasks f() } } func (s *Service) produce(f func()) { select { case s.tasks <- f: default: log.Error("tasks full") } }