// NotifyPolicyChange to receive policy when it change
NotifyPolicyChange to receive policy when it change
// NotifyPolicyChange to receive policy when it change
func (rc *Container) NotifyPolicyChange(method string, p Policy) {
	rc.Lock()
	defer rc.Unlock()
	rc.msg = ""
	if rc.cliRetryer != nil {
		return
	}
	r, ok := rc.retryerMap.Load(method)
	if ok && r != nil {
		retryer, ok := r.(Retryer)
		if ok {
			if retryer.Type() == p.Type {
				retryer.UpdatePolicy(p)
				rc.msg = fmt.Sprintf("update retryer[%s-%s] at %s", method, retryer.Type(), time.Now())
				return
			}
			rc.retryerMap.Delete(method)
			rc.msg = fmt.Sprintf("delete retryer[%s-%s] at %s", method, retryer.Type(), time.Now())
		}
	}
	rc.initRetryer(method, p)
}
func ( rc * Container ) NotifyPolicyChange ( method string , p Policy ) { rc . Lock ( ) defer rc . Unlock ( ) rc . msg = " " if rc . cliRetryer != nil { return } r , ok := rc . retryerMap . Load ( method ) if ok && r != nil { retryer , ok := r . ( Retryer ) if ok { if retryer . Type ( ) == p . Type { retryer . UpdatePolicy ( p ) rc . msg = fmt . Sprintf ( " " , method , retryer . Type ( ) , time . Now ( ) ) return } rc . retryerMap . Delete ( method ) rc . msg = fmt . Sprintf ( " " , method , retryer . Type ( ) , time . Now ( ) ) } } rc . initRetryer ( method , p ) }
NotifyPolicyChange to receive policy when it change
NotifyPolicyChange to receive policy when it change
// cliRetryer is not nil means that user setup code policy, the priority is higher than remote config