use of com.actionworks.flashsale.config.annotion.BetaTrace in project flash-sale by ThoughtsBeta.
the class FlashItemWarmUpScheduler method warmUpFlashItemTask.
@Scheduled(cron = "*/5 * * * * ?")
@BetaTrace
public void warmUpFlashItemTask() {
logger.info("warmUpFlashItemTask|秒杀品预热调度");
PagesQueryCondition pagesQueryCondition = new PagesQueryCondition();
pagesQueryCondition.setStockWarmUp(0);
PageResult<FlashItem> pageResult = flashItemDomainService.getFlashItems(pagesQueryCondition);
pageResult.getData().forEach(flashItem -> {
boolean initSuccess = itemStockCacheService.alignItemStocks(flashItem.getId());
if (!initSuccess) {
logger.info("warmUpFlashItemTask|秒杀品库存已经初始化预热失败", flashItem.getId());
return;
}
flashItem.setStockWarmUp(1);
flashItemDomainService.publishFlashItem(flashItem);
logger.info("warmUpFlashItemTask|秒杀品库存已经初始化预热成功", flashItem.getId());
});
}
use of com.actionworks.flashsale.config.annotion.BetaTrace in project flash-sale by ThoughtsBeta.
the class StocksAlignScheduler method alignStocksTask.
@Scheduled(cron = "*/2 * * * * ?")
@BetaTrace
public void alignStocksTask() {
logger.info("alignStocksTask|校准库存缓存开始");
PagesQueryCondition pagesQueryCondition = new PagesQueryCondition();
pagesQueryCondition.setStatus(FlashItemStatus.ONLINE.getCode());
PageResult<FlashItem> pageResult = flashItemDomainService.getFlashItems(pagesQueryCondition);
pageResult.getData().forEach(flashItem -> {
boolean result = itemStockCacheService.alignItemStocks(flashItem.getId());
if (!result) {
logger.info("alignStocksTask|库存校准失败", flashItem.getId(), flashItem.getAvailableStock());
return;
}
logger.info("alignStocksTask|库存校准完成", flashItem.getId(), flashItem.getAvailableStock());
});
logger.info("alignStocksTask|校准库存缓存结束");
}
Aggregations