Authored by DengXinFei

Update limitcode.md

## 首问负责,严禁推诿
### 1、首问负责,严禁推诿
首问负责制:无论是线上问题还是测试问题,第一责任人要负责对问题的跟踪,解决以及闭环。
### 2、每天分析线上异常日志,提交结果
如: 商品服务调用失败,查询品牌超时,定位超时原因是网络原因,或者程序问题,或者脚本写的有问题。并给出相应的修改建议。
:http://172.31.25.3:8083/product/brandSearch/queryBrand failed with exception.
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://172.31.25.3:8083/product/brandSearch/queryBrand":Rea
d timed out; nested exception is java.net.SocketTimeoutException: Read timed out
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:607)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:557)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:357)
at com.yoho.core.rest.client.RestTemplateUtils.post(RestTemplateUtils.java:48)
at com.yoho.core.rest.client.hystrix.HytrixPostCommand.getOrPost(HytrixPostCommand.java:27)
at com.yoho.core.rest.client.hystrix.HytrixBaseCommand.run(HytrixBaseCommand.java:147)
at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294)
at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289)
at rx.Observable$2.call(Observable.java:162)
at rx.Observable$2.call(Observable.java:154)
at rx.Observable$2.call(Observable.java:162)
at rx.Observable$2.call(Observable.java:154)
at rx.Observable$2.call(Observable.java:162)
at rx.Observable$2.call(Observable.java:154)
at rx.Observable.unsafeSubscribe(Observable.java:7710)
at com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:517)
at com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:495)
at rx.Observable.unsafeSubscribe(Observable.java:7710)
at rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
at com.yoho.core.trace.instrument.hystrix.SleuthHystrixConcurrencyStrategy$HystrixTraceCallable.call(SleuthHystrixConcurrencyStrategy.java
:140)
### 3、每周一之前检查组内下周工作计划,最大粒度的工作不超过3人天
每周一要输出本周的开发计划,并录入到伙伴云表格中,并定时更新状态。参考
https://app.huoban.com/apps/1745147
### 4、每月至少组织一次review代码,提交review结果
组长组织组员每月review重要代码,并提交review结果,以及修改建议
public boolean checkFavorite(Integer userId, Integer productId, Integer appType) {
try {
//只查询缓存,如果缓存不存在也不要去查库了
boolean existFlag = cacheService.isExistUserProductFavoriteByProductId(userId, productId,appType,true);
if (existFlag) {
return true;
} else {
if (!cacheService.hasUserFavoriteProductKey(userId,appType,false)) {
List<Favorite> favoriteList = favoriteMapper.selectAllProductIdListByUserId(TableUtils.getShardFactor(userId), userId,appType);
cacheService.batchSetFavoriteProduct(userId, favoriteList,appType);
return containsProductId(favoriteList, productId);
}
return false;
}
}
catch(Exception e) {
logger.warn("checkUserFavoriteProduct failed userId is:{},productId is:{}",userId,productId);
return false; //无关紧要的逻辑抛了异常也不能影响
}
}
... ...