fix feed pagination order, moderation reject and cache invalidation
- getFeed: add id DESC as tie-breaker so posts with equal createdAt are not duplicated or lost between pages - moderation: AI verdict false now sets REJECTED instead of ACTIVE - nightly cleanup: invalidate feed and map caches after deleting posts Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,8 @@ import com.krylov.refound.entity.Post;
|
||||
import com.krylov.refound.enums.PostStatus;
|
||||
import com.krylov.refound.repository.FavoriteRepository;
|
||||
import com.krylov.refound.repository.PostRepository;
|
||||
import com.krylov.refound.service.redis.MapCacheService;
|
||||
import com.krylov.refound.service.redis.PostCacheService;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -20,6 +22,8 @@ public class SchedulerService {
|
||||
private final PostRepository postRepository;
|
||||
private final FavoriteRepository favoriteRepository;
|
||||
private final PostModerationExecutorService postModerationExecutorService;
|
||||
private final PostCacheService postCacheService;
|
||||
private final MapCacheService mapCacheService;
|
||||
|
||||
/**
|
||||
* Runs every day at 00:01 to delete:
|
||||
@@ -55,6 +59,12 @@ public class SchedulerService {
|
||||
log.info("Deleted {} posts older than 6 months", oldPosts.size());
|
||||
}
|
||||
|
||||
if (!closedPosts.isEmpty() || !oldPosts.isEmpty()) {
|
||||
// Иначе удалённые посты висят в ленте и на карте до TTL кэша
|
||||
postCacheService.invalidatePosts();
|
||||
mapCacheService.clearMapMarkersCache();
|
||||
}
|
||||
|
||||
log.info("Scheduled cleanup completed successfully");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user