Skip to content

Commit dabbb93

Browse files
committed
update: pre improve test set - 30m50s88ms
1 parent 701929e commit dabbb93

File tree

5 files changed

+31
-30
lines changed

5 files changed

+31
-30
lines changed

src/main/kotlin/gogo/gogobetting/domain/batch/root/application/BatchServiceImpl.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ class BatchServiceImpl(
2323
) : BatchService {
2424

2525
override fun batch(matchId: Long, dto: BatchDto) {
26-
val studentId = userUtil.getCurrentStudent().studentId
27-
28-
val isEmptyBetting = batchValidator.valid(matchId, studentId, dto)
29-
30-
if (isEmptyBetting) {
31-
batchProcessor.emptyBettingBatch(matchId, dto, studentId, isEmptyBetting)
32-
return
33-
}
26+
// val studentId = userUtil.getCurrentStudent().studentId
27+
//
28+
// val isEmptyBetting = batchValidator.valid(matchId, studentId, dto)
29+
//
30+
// if (isEmptyBetting) {
31+
// batchProcessor.emptyBettingBatch(matchId, dto, studentId, isEmptyBetting)
32+
// return
33+
// }
3434

3535
val bettingOdds = batchReader.readBettingOdds(matchId, dto.winTeamId)
3636

3737
val jobParameters = JobParametersBuilder()
3838
.addLong("matchId", matchId)
39-
.addLong("studentId", studentId)
39+
.addLong("studentId", 0L)
4040
.addLong("winTeamId", dto.winTeamId)
4141
.addLong("aTeamScore", dto.aTeamScore.toLong())
4242
.addLong("bTeamScore", dto.bTeamScore.toLong())

src/main/kotlin/gogo/gogobetting/global/config/SecurityConfig.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ class SecurityConfig(
5858
httpRequests.requestMatchers(HttpMethod.POST, "/betting/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
5959

6060
// batch
61-
httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
61+
// httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
62+
httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/{match_id}").permitAll()
6263
httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/cancel/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
6364

6465
// server to server

src/main/kotlin/gogo/gogobetting/infra/batch/config/BettingBatchJobConfig.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class BettingBatchJobConfig(
4242
transactionManager: PlatformTransactionManager,
4343
): Step {
4444
return StepBuilder("bettingStep", jobRepository)
45-
.chunk<Betting, BettingResult>(50)
45+
.chunk<Betting, BettingResult>(1000)
4646
.transactionManager(transactionManager)
4747
.reader(bettingReader.bettingReader(null))
4848
.processor(bettingProcessor)

src/main/kotlin/gogo/gogobetting/infra/batch/service/BettingReader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class BettingReader(
2424
setEntityManagerFactory(entityManagerFactory)
2525
setQueryString("SELECT b FROM Betting b WHERE b.matchId = :matchId AND b.status = :status ORDER BY b.id")
2626
setParameterValues(mapOf("matchId" to validMatchId, "status" to BettingStatus.CONFIRMED))
27-
pageSize = 50
27+
pageSize = 1000
2828
}
2929
}
3030

src/main/kotlin/gogo/gogobetting/infra/batch/service/BettingWriter.kt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,24 @@ class BettingWriter(
7070
)
7171
)
7272

73-
val successList = accumulatedItems.filter { it.isPredicted }
74-
.map {
75-
val studentId = bettingRepository.findByIdOrNull(it.bettingId)!!.studentId
76-
StudentBettingDto(studentId, it.earnedPoint)
77-
}
78-
79-
val event = MatchBatchEvent(
80-
id = UUID.randomUUID().toString(),
81-
batchId = batchId,
82-
matchId = matchId,
83-
victoryTeamId = winTeamId,
84-
aTeamScore = aTeamScore,
85-
bTeamScore = bTeamScore,
86-
students = successList
87-
)
88-
89-
log.info("published betting batch application event: {}", event.id)
90-
batchPublisher.publishBettingBatchEvent(event)
73+
// val successList = accumulatedItems.filter { it.isPredicted }
74+
// .map {
75+
// val studentId = bettingRepository.findByIdOrNull(it.bettingId)!!.studentId
76+
// StudentBettingDto(studentId, it.earnedPoint)
77+
// }
78+
//
79+
// val event = MatchBatchEvent(
80+
// id = UUID.randomUUID().toString(),
81+
// batchId = batchId,
82+
// matchId = matchId,
83+
// victoryTeamId = winTeamId,
84+
// aTeamScore = aTeamScore,
85+
// bTeamScore = bTeamScore,
86+
// students = successList
87+
// )
88+
//
89+
// log.info("published betting batch application event: {}", event.id)
90+
// batchPublisher.publishBettingBatchEvent(event)
9191
}
9292

9393
override fun write(items: Chunk<out BettingResult>) {

0 commit comments

Comments
 (0)