File tree Expand file tree Collapse file tree
src/main/java/com/web/coreclass/global/s3 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,11 @@ public class S3CleanupScheduler {
3737 @ Value ("${spring.cloud.aws.s3.bucket}" )
3838 private String bucket ;
3939
40+ private static final Set <String > FIXED_FILES = Set .of (
41+ "overwatch2_logo.png" , // 예시 1: 기본 프로필 이미지
42+ "valorant_logo.png" // 예시 2: 고정 배너 이미지
43+ );
44+
4045 // 매일 새벽 4시에 실행 (초 분 시 일 월 요일)
4146 @ Scheduled (cron = "0 0 4 * * *" )
4247 public void cleanupOrphanImages () {
@@ -45,6 +50,9 @@ public void cleanupOrphanImages() {
4550 // 1. DB에 등록된 '사용 중인' 이미지 파일명 다 모으기
4651 Set <String > validFileNames = new HashSet <>();
4752
53+ // 고정 파일들은 무조건 '사용 중'으로 처리해서 보호
54+ validFileNames .addAll (FIXED_FILES );
55+
4856 // (1) 강사 관련 이미지
4957 validFileNames .addAll (extractFileNames (instructorRepository .findAllProfileImgUrls ()));
5058 validFileNames .addAll (extractFileNames (instructorRepository .findAllSgeaLogoImgUrls ()));
You can’t perform that action at this time.
0 commit comments