diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/PropCouponExpireTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/PropCouponExpireTask.java index def71100..f305031b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/PropCouponExpireTask.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/PropCouponExpireTask.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.scheduler; +import com.red.circle.component.redis.annotation.TaskCacheLock; import com.red.circle.other.domain.gateway.PropCouponGateway; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -24,6 +25,7 @@ public class PropCouponExpireTask { * 每小时执行一次 */ @Scheduled(cron = "0 0 * * * ?") + @TaskCacheLock(key = "PROP_COUPON_EXPIRE_TASK", expireSecond = 60 * 50) public void expireCoupons() { try { Integer count = propCouponGateway.expireOverdueCoupons(); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RocketStatusSyncTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RocketStatusSyncTask.java index 1f3dfdb1..57c1a5f4 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RocketStatusSyncTask.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RocketStatusSyncTask.java @@ -3,6 +3,7 @@ package com.red.circle.other.app.scheduler; import cn.hutool.core.date.DateUtil; +import com.red.circle.component.redis.annotation.TaskCacheLock; import com.red.circle.other.app.service.room.RocketStatusCacheService; import com.red.circle.other.domain.gateway.RocketStatusGateway; import com.red.circle.other.domain.rocket.RocketStatus; @@ -32,6 +33,7 @@ public class RocketStatusSyncTask { * 每5分钟同步一次火箭状态 */ @Scheduled(cron = "0 */5 * * * ?") + @TaskCacheLock(key = "ROCKET_STATUS_SYNC_TASK", expireSecond = 60 * 4) public void syncRocketStatus() { try { // 获取当前日期 格式: yyyyMMdd diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomContributionWeeklyRewardTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomContributionWeeklyRewardTask.java index 040113b6..96ac312b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomContributionWeeklyRewardTask.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomContributionWeeklyRewardTask.java @@ -1,5 +1,6 @@ package com.red.circle.other.app.scheduler; +import com.red.circle.component.redis.annotation.TaskCacheLock; import com.red.circle.other.infra.database.mongo.entity.activity.RoomContributionActivityCount; import com.red.circle.other.infra.database.mongo.service.activity.RoomContributionActivityCountService; import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService; @@ -45,6 +46,7 @@ public class RoomContributionWeeklyRewardTask { * Asia/Riyadh 时区(UTC+3) */ @Scheduled(cron = "0 0 0 * * MON", zone = "Asia/Riyadh") + @TaskCacheLock(key = "ROOM_CONTRIBUTION_REWARD_TASK", expireSecond = 86400) public void execute() { log.info("【房间贡献周奖励】定时任务开始执行..."); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomRedPacketExpireTask.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomRedPacketExpireTask.java index 897bee64..3238ec82 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomRedPacketExpireTask.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/scheduler/RoomRedPacketExpireTask.java @@ -1,6 +1,7 @@ package com.red.circle.other.app.scheduler; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; +import com.red.circle.component.redis.annotation.TaskCacheLock; import com.red.circle.other.domain.gateway.RoomRedPacketGateway; import com.red.circle.other.domain.redpacket.RoomRedPacket; import com.red.circle.other.domain.redpacket.RoomRedPacketRefundStatus; @@ -33,9 +34,10 @@ public class RoomRedPacketExpireTask { private final WalletGoldClient walletGoldClient; /** - * 每分钟执行一次 + * 每30秒执行一次 */ @Scheduled(cron = "0/30 * * * * ?") + @TaskCacheLock(key = "ROOM_RED_PACKET_TASK", expireSecond = 20) public void refundExpiredPackets() { try { LocalDateTime now = LocalDateTime.now();