Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3618452
🐛 fix : dto 정규표현식 수정
kmchaejin Jun 9, 2025
484f6a3
✨ feat : 포스팅 횟수 증가 및 예외처리
kmchaejin Jun 9, 2025
68f4529
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 9, 2025
e64b1ae
✨ feat : postingCount 스케줄링
kmchaejin Jun 9, 2025
c522f4c
✨ feat : 게시글 조회시 검증 로직 추가
kmchaejin Jun 9, 2025
c3730ec
✨ feat : 오픈런 게시글 closed 하는 스케줄러 구현
kmchaejin Jun 9, 2025
c369cb4
♻️ refactor : 스케줄링 누락 방지
kmchaejin Jun 9, 2025
992afab
✨ feat : board status 변경 메서드 구현
kmchaejin Jun 10, 2025
92c2410
🐛 fix : 에러코드 수정
kmchaejin Jun 10, 2025
4765c86
✨ feat : 선착순 기능 구현 및 책임 분리
kmchaejin Jun 10, 2025
24a375f
fix : 충돌 병합
kmchaejin Jun 10, 2025
6b15cea
🐛 fix : 오류 해결
kmchaejin Jun 10, 2025
8e252c8
✨ feat : 오픈런 게시글 조회 api 구현
kmchaejin Jun 10, 2025
5190ca7
✨ feat : 페이징 디폴트값 설정
kmchaejin Jun 10, 2025
b0b5e28
🐛 fix : 임시 버그 수정
kmchaejin Jun 11, 2025
1d1dad8
✨ feat : 웹소켓 관련 오픈런 게시글 기능 구현
kmchaejin Jun 11, 2025
2e84520
🔥 remove : 주석 정리
kmchaejin Jun 11, 2025
badf220
fix : 충돌 해결
kmchaejin Jun 11, 2025
b5cc8b6
🐛 fix : jpa 메서드명 관련 오류 해결
kmchaejin Jun 11, 2025
f144cdf
🐛 fix : 오류 수정 및 리팩토링
kmchaejin Jun 11, 2025
1499b25
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 11, 2025
55fa5fc
🐛 fix : 유효성 검증 어노테이션 수정
kmchaejin Jun 11, 2025
15964ad
♻️ refactor : 불필요한 래퍼 클래스 기본 타입으로 변경, clearAutomatically 옵션 적용
kmchaejin Jun 11, 2025
7b3eeb6
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 12, 2025
9b155ef
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 12, 2025
ef85205
♻️ refactor : 삭제된 데이터 제외하고 조회
kmchaejin Jun 12, 2025
b617ab4
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 13, 2025
bc7c339
🧪 test : 테스트코드 작성 및 일부 수정
kmchaejin Jun 15, 2025
226a72d
🐛 fix : 코드리뷰 반영
kmchaejin Jun 15, 2025
e51fcd7
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 15, 2025
65d80e7
♻️ refactor : 하드코딩된 코드 수정
kmchaejin Jun 15, 2025
11a2a20
fix : 충돌 해결
kmchaejin Jun 16, 2025
542489b
🐛 fix : 웹소켓 config 수정 반영
kmchaejin Jun 16, 2025
bbcfaf8
fix : 충돌 해결
kmchaejin Jun 16, 2025
c9d1bdd
🐛 fix : null 검증
kmchaejin Jun 16, 2025
4c85898
🐛 fix : 오류 해결
kmchaejin Jun 16, 2025
7b5f848
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into fe…
kmchaejin Jun 16, 2025
7b92732
🐛 fix : 오류 해결
kmchaejin Jun 16, 2025
238bcff
Merge branch 'feat#58/openrun' of https://github.com/mo00ai/your-my-t…
kmchaejin Jun 16, 2025
d182bcf
fix : merge
kmchaejin Jun 18, 2025
ab5adcb
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into dev
kmchaejin Jun 24, 2025
1ffe677
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into dev
kmchaejin Jul 1, 2025
d6982fc
🐛 fix : 프로퍼티즈 수정
kmchaejin Jul 1, 2025
15d7a27
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into dev
kmchaejin Jul 5, 2025
cfd6190
Merge branch 'dev' of https://github.com/mo00ai/your-my-taste into dev
kmchaejin Jul 14, 2025
c3c39db
refactor : 트리거 수행 시간 변경
kmchaejin Aug 6, 2025
fc59eff
feat : IteratorItemReader 방식으로 변경
kmchaejin Aug 6, 2025
db3454d
fix : prometheus 버전 관련 오류 해결
kmchaejin Aug 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ dependencies {

// prometheus
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'io.micrometer:micrometer-registry-prometheus:1.15.0'
implementation 'io.prometheus:prometheus-metrics-core:1.0.0'

//firebase
implementation 'com.google.firebase:firebase-admin:9.5.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static com.example.taste.domain.board.entity.AccessPolicy.*;

import java.util.Iterator;
import java.util.List;

import org.springframework.batch.core.Job;
Expand All @@ -15,6 +14,7 @@
import org.springframework.batch.core.step.builder.StepBuilder;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.support.IteratorItemReader;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.dao.DataAccessException;
Expand Down Expand Up @@ -82,16 +82,6 @@ public <T, E extends Throwable> void onError(RetryContext context, RetryCallback
.build();
}

// @Bean
// @StepScope
// public ItemReader<Long> closingBoardReader(BoardService boardService) {
// // 1차 캐시가 bulk 연산을 덮어쓰지 않도록 board가 아닌 id 값만 반환
// log.info("스케줄러 실행 시간 : {}", System.currentTimeMillis());
// List<Long> expiredBoardIds = boardService.findExpiredTimeAttackBoardIds(TIMEATTACK);
// //log.debug("[BoardScheduler] 만료된 오픈런 게시글 id: {}", expiredBoardIds);
// return new IteratorItemReader<>(expiredBoardIds);
// }

// @Bean
// @StepScope
// public ItemReader<Long> closingBoardReader(BoardService boardService) {
Expand Down Expand Up @@ -126,39 +116,49 @@ public <T, E extends Throwable> void onError(RetryContext context, RetryCallback
// };
// }

// @Bean
// @StepScope
// public ItemReader<Long> closingBoardReader(BoardService boardService) {
// return new ItemReader<>() {
// private static final int PAGE_SIZE = 100;
// private Long lastSeenId = 0L;
// private Iterator<Long> currentIterator = null;
// private boolean noMoreData = false;
//
// @Override
// public Long read() {
// if (noMoreData) {
// return null;
// }
//
// // 현재 iterator가 없거나 모두 소비했으면 다음 페이지 조회
// if (currentIterator == null || !currentIterator.hasNext()) {
// List<Long> nextPage = boardService.findExpiredTimeAttackBoardIdsAfterId(TIMEATTACK, lastSeenId,
// PAGE_SIZE);
//
// if (nextPage == null || nextPage.isEmpty()) {
// noMoreData = true;
// return null;
// }
//
// currentIterator = nextPage.iterator();
// }
//
// Long next = currentIterator.next();
// lastSeenId = next;
// return next;
// }
// };
// }

@Bean
@StepScope
public ItemReader<Long> closingBoardReader(BoardService boardService) {
return new ItemReader<>() {
private static final int PAGE_SIZE = 100;
private Long lastSeenId = 0L;
private Iterator<Long> currentIterator = null;
private boolean noMoreData = false;

@Override
public Long read() {
if (noMoreData) {
return null;
}

// 현재 iterator가 없거나 모두 소비했으면 다음 페이지 조회
if (currentIterator == null || !currentIterator.hasNext()) {
List<Long> nextPage = boardService.findExpiredTimeAttackBoardIdsAfterId(TIMEATTACK, lastSeenId,
PAGE_SIZE);

if (nextPage == null || nextPage.isEmpty()) {
noMoreData = true;
return null;
}

currentIterator = nextPage.iterator();
}

Long next = currentIterator.next();
lastSeenId = next;
return next;
}
};
// 1차 캐시가 bulk 연산을 덮어쓰지 않도록 board가 아닌 id 값만 반환
log.info("스케줄러 실행 시간 : {}", System.currentTimeMillis());
List<Long> expiredBoardIds = boardService.findExpiredTimeAttackBoardIds(TIMEATTACK);
log.debug("[BoardScheduler] 만료된 오픈런 게시글 id: {}", expiredBoardIds);
return new IteratorItemReader<>(expiredBoardIds);
}

@Bean
Expand All @@ -172,7 +172,6 @@ public ItemWriter<Long> closingBoardWriter(BoardService boardService) {

long updatedCount = boardService.closeTimeAttackBoardsByIds(items.getItems());
counter.increment(updatedCount);
log.info("[BoardScheduler] 다음 게시글들을 CLOSED로 변경함: {}", items.getItems());
log.info("[BoardScheduler] 총 {}건 게시글 상태 변경 완료", updatedCount);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Trigger closingBoardJobTrigger(JobDetail closingBoardJobDetail) {
return TriggerBuilder.newTrigger()
.forJob(closingBoardJobDetail)
.withIdentity("closingBoardJobTrigger")
.withSchedule(CronScheduleBuilder.cronSchedule("0 0/10 * * * ?"))
.withSchedule(CronScheduleBuilder.cronSchedule("0 0 4 * * ?"))
.build();
}
}