Commit 4f39de4e authored by jiaorz's avatar jiaorz

Merge branch 'master-activity-bk'

parents bbe1b1a6 48ad304b
......@@ -86,11 +86,14 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper, Act
}});
log.info("活动邀请注册:activityPopularize = {}", activityPopularize.toString());
if (activityPopularize != null) {
String lockKey = String.format("%s%d:%s:%d",registerQueueDTO.getInParamDTO().getActivityCode(), registerQueueDTO.getAppUserId(), registerQueueDTO.getInParamDTO().getUsername(), activityPopularize.getId());
String lockKey = String.format("%s%d%d", registerQueueDTO.getInParamDTO().getActivityCode(), appUserDTO.getInviterAccount(), activityPopularize.getId());
RLock rLock = redissonLock.getRLock(lockKey);
try {
boolean isSuccess = rLock.tryLock(5, 5, TimeUnit.SECONDS);
if (isSuccess) {
log.info("1, {}", System.currentTimeMillis());
Thread.sleep(1000);
log.info("2, {}", System.currentTimeMillis());
List<ActivityPopularizeItem> activityPopularizeItems = activityPopularizeItemBiz.selectByPopularizeId(activityPopularize.getId());
ActivityPopularizeItem activityPopularizeItem = activityPopularizeItems.get(activityPopularizeItems.size() - 1);
Date now = DateUtil.date();
......@@ -196,6 +199,8 @@ public class ActivityPopularizeBiz extends BaseBiz<ActivityPopularizeMapper, Act
}
} catch (InterruptedException e) {
log.error("tryLock fail, key = [{}]", lockKey);
} finally {
log.info("执行结束, {}", System.currentTimeMillis());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment