Authored by hugufei

全量建索引时ProductCollageInfoJob直接返回

... ... @@ -5,6 +5,7 @@ import com.yoho.search.base.utils.DateUtil;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.increment.bulks.CommonBulkService;
import com.yoho.search.consumer.index.rebuild.RebuildFlagService;
import com.yoho.search.consumer.service.bo.CollageInfoBO;
import com.yoho.search.consumer.service.daoService.ProductService;
import com.yoho.search.consumer.service.logicService.CollageLogicService;
... ... @@ -41,6 +42,8 @@ public class ProductCollageInfoJob {
private CollageLogicService collageLogicService;
@Autowired
private CommonBulkService commonBulkService;
@Autowired
private RebuildFlagService rebuildFlagService;
/**
* 每分钟执行一次,每次找出5分钟内即将生效的
... ... @@ -49,6 +52,10 @@ public class ProductCollageInfoJob {
public void updateCollagePrice() {
try {
logger.info("ProductCollageInfoJob begin ...");
if(rebuildFlagService.isRebuilding()){
logger.info("index is Rebuilding,direct return....");
return;
}
//1、获取即将开始的活动
long minBeginTime = DateUtil.getCurrentTimeSecond();
long maxBeginTime = minBeginTime + 5 * 60 * 100;//5分钟之内即将生效的
... ... @@ -86,9 +93,10 @@ public class ProductCollageInfoJob {
commonBulkService.add(new ESBluk(jsonObject.toJSONString(), productId.toString(), ISearchConstants.INDEX_NAME_PRODUCT_INDEX, ISearchConstants.INDEX_NAME_PRODUCT_INDEX, false));
logger.info("update productindex collageInfo success, info is [{}]", jsonObject);
}
logger.info("ProductCollageInfoJob end ...");
} catch (Exception e) {
logger.error(e.getMessage(), e);
}finally {
logger.info("ProductCollageInfoJob end ...");
}
}
... ...