Пример #1
0
func (n *Nerve) Stop() {
	logs.Info("Stopping nerve")
	close(n.serviceStopper)
	n.stopApi()
	n.servicesStopWait.Wait()
	logs.Debug("All services stopped")
}
Пример #2
0
func (s *Synapse) Stop() {
	logs.Info("Stopping synapse")
	s.stopApi()
	close(s.context.stop)
	s.context.doneWaiter.Wait()
	logs.Debug("All router stopped")
}
Пример #3
0
func (s *Synapse) Start(oneshot bool) error {
	logs.Info("Starting synapse")

	s.context = newContext(oneshot)
	for _, routers := range s.typedRouters {
		go routers.Run(s.context)
	}
	return s.startApi()
}
Пример #4
0
func (n *Nerve) Start(startStatus chan error) {
	logs.Info("Starting nerve")
	if len(n.Services) == 0 {
		if startStatus != nil {
			startStatus <- errs.WithF(n.fields, "No service specified")
		}
		return
	}

	for _, service := range n.Services {
		go service.Start(n.serviceStopper, &n.servicesStopWait)
	}

	res := n.startApi()
	if startStatus != nil {
		startStatus <- res
	}
}