定时任务-礼物-mq-并行补偿
This commit is contained in:
@@ -29,13 +29,13 @@ public class GiftTask extends BaseTask {
|
||||
if (map == null || map.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Set<String> keySet = map.keySet();
|
||||
long curTime = System.currentTimeMillis();
|
||||
long gapTime = 1000 * 60 * 10; // 十分钟内没被消费
|
||||
|
||||
for (String key : keySet) {
|
||||
map.entrySet().parallelStream().forEach(entry -> {
|
||||
try {
|
||||
String val = map.get(key);
|
||||
String messId = entry.getKey();
|
||||
String val = entry.getValue();
|
||||
GiftMessage giftMessage = gson.fromJson(val, GiftMessage.class);
|
||||
if (curTime - giftMessage.getMessTime() > gapTime) {
|
||||
giftMessageService.handleGiftMessage(giftMessage);
|
||||
@@ -43,7 +43,7 @@ public class GiftTask extends BaseTask {
|
||||
} catch (Exception e) {
|
||||
log.error("retryGiftQueue error", e);
|
||||
}
|
||||
}
|
||||
});
|
||||
log.info("retryGiftQueue end ...");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user