Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class RedisReportConsumer {
private String QUEUE_KEY;
private static final long BATCH_SIZE = 20;

@Transactional
@Scheduled(cron = "0 0/5 * * * *") // 정각부터 5분 마다 실행
public void pollQueueEvery30Minutes() {
long now = Instant.now().getEpochSecond();
Expand All @@ -37,7 +36,7 @@ public void pollQueueEvery30Minutes() {

for (String id : dueIds) {
// Worker Queue로 push
redisTemplate.opsForList().leftPush("report-worker-queue", id);
redisTemplate.opsForList().leftPush("REPORT_WORKER_QUEUE", id);
// ZSET에서는 제거
redisTemplate.opsForZSet().remove(QUEUE_KEY, id);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/haru/api/infra/redis/ReportWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ReportWorker {
private final MoodTrackerReportService reportService;
private final ExecutorService executor = Executors.newFixedThreadPool(5); // 5개 병렬 Worker

private static final String WORKER_QUEUE = "report-worker-queue";
private static final String WORKER_QUEUE = "REPORT_WORKER_QUEUE";

@Scheduled(fixedDelay = 2000) // 2초마다 큐 확인
public void consumeTasks() {
Expand All @@ -44,7 +44,7 @@ private void process(Long moodTrackerId) {
redisTemplate.opsForList().leftPush(WORKER_QUEUE, moodTrackerId.toString());
} else {
log.error("재시도 한계 초과, 실패 큐로 이동: {}", moodTrackerId);
redisTemplate.opsForList().leftPush("report-failed-queue", moodTrackerId.toString());
redisTemplate.opsForList().leftPush("REPORT_FAILED_QUEUE", moodTrackerId.toString());
}
}
}
Expand Down