Fix post deletion, moderation races and cache leftovers
- PostService.delete did not remove favorites (FK without cascade -> 500 once a post was favorited) or chat links; owner, admin and nightly cleanup now share PostDeletionService, which deletes MinIO files only after commit. The nightly job also removes the images of expired posts. - Moderation reads a snapshot in a short transaction, calls AI outside of it and applies the verdict only if the post is still in MODERATION and unchanged, so an edit made during a check can no longer go live unmoderated. Storage/AI outages keep the post in MODERATION instead of rejecting it. - Posts without a category broke PostMapper with an NPE; title/phone/reward and address are checked against column sizes; a long address no longer overflows posts.city; Nominatim outages fall back to the address instead of 503. - Favorites list hides posts that are back in moderation or rejected. - Statistics counters use atomic UPDATEs instead of read-modify-write. - Removed MapCacheService: its version key was bumped but never read. - hibernate.default_batch_fetch_size=50 removes N+1 on images/users; show-sql is off by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@ package com.krylov.refound.config;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.krylov.refound.dto.CachedMapMarkers;
|
||||
import com.krylov.refound.dto.CachedPostPage;
|
||||
import com.krylov.refound.dto.MapMarkerDto;
|
||||
import java.util.List;
|
||||
@@ -21,11 +20,6 @@ public class RedisConfig {
|
||||
return buildTemplate(connectionFactory, objectMapper, CachedPostPage.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, CachedMapMarkers> feedRedisTemplate(RedisConnectionFactory connectionFactory, ObjectMapper objectMapper) {
|
||||
return buildTemplate(connectionFactory, objectMapper, CachedMapMarkers.class);
|
||||
}
|
||||
|
||||
private static <T> RedisTemplate<String, T> buildTemplate(RedisConnectionFactory connectionFactory, ObjectMapper objectMapper, Class<T> type) {
|
||||
// Своя копия: изменения веб-настроек ObjectMapper не должны ломать формат кэша,
|
||||
// а неизвестные поля в старых записях не должны валить десериализацию
|
||||
|
||||
Reference in New Issue
Block a user