Beispiel #1
0
func (c *Client) Destroy() (err error) {
	end := time.Now().Add(c.Interval)
	for time.Now().Before(end) {
		err = c.client.Destroy()
		if e.FindStr(err, "instance not found") > -1 {
			return
		} else if e.FindStr(err, "instance init failed") > -1 {
			return
		} else if err != nil {
			time.Sleep(c.Sleep)
			continue
		}
		break
	}
	return
}
Beispiel #2
0
func (s *Server) cleanUpChannelInstance(inst Valuer, conn InstConn) {
	if !inst.Instance().IsNil() {
		inst.Instance().Close()
		inst.NilInstance()
	}
	err := s.Insts.Delete(conn.SessionName(), conn.InstanceName())
	if err != nil && e.FindStr(err, "instance not found") == -1 {
		log.Tag("gormethods", "server", "channel").Errorf("Can't remove the instance %v/%v. %v", conn.SessionName(), conn.InstanceName(), err)
	}
}
Beispiel #3
0
func (c *Client) Call(method string, args, retvals []reflect.Value) (err error) {
	end := time.Now().Add(c.Interval)
	for time.Now().Before(end) {
		err = c.client.Call(method, args, retvals)
		if e.FindStr(err, "method not found") > -1 {
			return
		} else if e.FindStr(err, "instance not found") > -1 {
			return
		} else if err != nil {
			time.Sleep(c.Sleep)
			continue
		}
		// if e.Find(err, gerr.ErrNetFail) >= 0 {
		// 	time.Sleep(c.Sleep)
		// 	continue
		// } else if err != nil {
		// 	return e.Forward(err)
		// }
		break
	}
	return
}