mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-18 04:50:57 +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.ConcurrentMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -108,8 +108,8 @@ public class PostService {
|
||||
this.publishMode = publishMode;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void rescheduleLotteries() {
|
||||
@EventListener(ApplicationReadyEvent.class)
|
||||
public void rescheduleLotteries() {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (LotteryPost lp : lotteryPostRepository.findByEndTimeAfterAndWinnersIsEmpty(now)) {
|
||||
ScheduledFuture<?> future = taskScheduler.schedule(
|
||||
|
||||
Reference in New Issue
Block a user