// Run starts a Handler running logic
Run starts a Handler running logic
// Run starts a Handler running logic
func (h *Handler) Run() {
	coordinatorAddress := h.cfg.Worker.Network.CoordinatorAddress
	for {
		conn, err := newCoordinatorConnection(coordinatorAddress, h.cfg.Worker, h.address)
		if err != nil {
			log.Printf("Cannot connect to coordinator. %v Retrying...", err)
			time.Sleep(time.Second)
			continue
		}
		log.Printf("[worker] connected to: %v", coordinatorAddress)
		h.oClient = conn
		go h.oClient.Heartbeat()
		h.routes()
		h.oClient.Listen()
	}
}
func ( h * Handler ) Run ( ) { coordinatorAddress := h . cfg . Worker . Network . CoordinatorAddress for { conn , err := newCoordinatorConnection ( coordinatorAddress , h . cfg . Worker , h . address ) if err != nil { log . Printf ( " " , err ) time . Sleep ( time . Second ) continue } log . Printf ( " " , coordinatorAddress ) h . oClient = conn go h . oClient . Heartbeat ( ) h . routes ( ) h . oClient . Listen ( ) } }
Run starts a Handler running logic
Run starts a Handler running logic
// If cannot listen, reconnect to coordinator