mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-04-20 10:57:28 +08:00
Handle self-invocation in PostService
This commit is contained in:
@@ -43,8 +43,8 @@ import java.util.HashSet;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import jakarta.annotation.PostConstruct;
|
import org.springframework.context.event.EventListener;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@@ -108,8 +108,8 @@ public class PostService {
|
|||||||
this.publishMode = publishMode;
|
this.publishMode = publishMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
private void rescheduleLotteries() {
|
public void rescheduleLotteries() {
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
for (LotteryPost lp : lotteryPostRepository.findByEndTimeAfterAndWinnersIsEmpty(now)) {
|
for (LotteryPost lp : lotteryPostRepository.findByEndTimeAfterAndWinnersIsEmpty(now)) {
|
||||||
ScheduledFuture<?> future = taskScheduler.schedule(
|
ScheduledFuture<?> future = taskScheduler.schedule(
|
||||||
|
|||||||
Reference in New Issue
Block a user