|
|
package com.yoho.search.service.base;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
...
|
...
|
@@ -10,6 +12,8 @@ import com.yoho.search.common.downgrade.persional.PersionalRateLimitConfig; |
|
|
@Service
|
|
|
public class SearchDynamicConfigService {
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(SearchDynamicConfigService.class);
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigReader configReader;
|
|
|
|
...
|
...
|
@@ -185,12 +189,17 @@ public class SearchDynamicConfigService { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 召回时是否使用全局品牌id
|
|
|
* 个性化降级配置
|
|
|
*/
|
|
|
public PersionalRateLimitConfig getPersionalRateLimitConfig(String rateLimitName,PersionalRateLimit persionalRateLimit){
|
|
|
String zkConfigKey = "search.persional.rateLimit" + rateLimitName.replaceAll("/", ".");
|
|
|
PersionalRateLimitConfig defalut = new PersionalRateLimitConfig(persionalRateLimit);
|
|
|
String zkConfigValue = configReader.getString(zkConfigKey, defalut.toZkValue());
|
|
|
return new PersionalRateLimitConfig(zkConfigValue);
|
|
|
try {
|
|
|
String zkConfigKey = "search.persional.rateLimit" + rateLimitName.replaceAll("/", ".");
|
|
|
PersionalRateLimitConfig defalut = new PersionalRateLimitConfig(persionalRateLimit);
|
|
|
String zkConfigValue = configReader.getString(zkConfigKey, defalut.toZkValue());
|
|
|
return new PersionalRateLimitConfig(zkConfigValue);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(),e);
|
|
|
return new PersionalRateLimitConfig(200,10);
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|