Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions back/src/main/java/com/back/global/config/AsyncConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.back.global.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.Executor;

@Configuration
@EnableAsync
public class AsyncConfig {

@Bean(name = "notificationExecutor")
public Executor notificationExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(10);
executor.setMaxPoolSize(50);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("NotiAsync-");
executor.initialize();
return executor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.back.notification.domain.NotificationRepository;
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

Expand All @@ -21,6 +22,7 @@ public SseEmitter subscribe(Long userId) {
return notificationSsePort.subscribe(userId);
}

@Async("notificationExecutor")
@Transactional // DB 저장을 위해 추가
public void send(Long userId, String eventName, Object content) {
String stringContent = extractContent(content);
Expand Down
4 changes: 2 additions & 2 deletions perf/k6/notifications/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@ export function notificationsPollerBurst() {
export default function () {
notificationsSmokeJourney();
}
sleep(THINK_SECONDS);
}
// sleep(THINK_SECONDS);
//}
4 changes: 3 additions & 1 deletion perf/k6/reports/reports.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ function readAdminReports(token) {
check(response, {
"admin reports list status 200": (res) => res.status === 200,
});
return asArray(dataOf(response));
//return asArray(dataOf(response));
const data = dataOf(response);
return asArray(data?.content || data);
}

function readAdminReportDetail(token, reportId) {
Expand Down