Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024-10-19 [Release Note] #198

Merged
merged 12 commits into from
Oct 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/friendship-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
sudo docker rm friendship || true

# 새 friendship 컨테이너 실행
sudo docker run -d --log-driver=syslog -p 443:8080 --name friendship --network friendship-network -e spring.profiles.active=prod -e TZ=Asia/Seoul ${{ secrets.DOCKER_USERNAME }}/${{ env.APP_NAME }}:latest
sudo docker run -v /home/ec2-user/elk/logs:/logs -d --log-driver=syslog -p 443:8080 --name friendship --network friendship-network -e spring.profiles.active=prod -e TZ=Asia/Seoul ${{ secrets.DOCKER_USERNAME }}/${{ env.APP_NAME }}:latest

# friendship 관련 종료된 컨테이너 삭제
sudo docker container prune -f
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ out/
.vscode/

### LOG ###
/src/main/resources/log/history/**
/logs
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:17-ea-11-jdk-slim
VOLUME /tmp
VOLUME /logs
COPY build/libs/backend-0.0.1-SNAPSHOT.jar FriendShip.jar
ENTRYPOINT ["java", "-jar", "FriendShip.jar"]
27 changes: 27 additions & 0 deletions src/main/java/com/aliens/backend/global/config/AsyncConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.aliens.backend.global.config;

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

import java.util.concurrent.Executor;

@Profile({"dev", "prod"})
@EnableAsync
@Configuration
public class AsyncConfig implements AsyncConfigurer {
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
int processors = Runtime.getRuntime().availableProcessors();
executor.setCorePoolSize(processors);
executor.setMaxPoolSize(processors * 2);
executor.setQueueCapacity(50);
executor.setKeepAliveSeconds(60);
executor.setThreadNamePrefix("AsyncExecutor-");
executor.initialize();
return executor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.google.firebase.messaging.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.List;
Expand All @@ -39,6 +40,7 @@ public FcmSender(MemberRepository memberRepository,
this.objectMapper = objectMapper;
}

@Async
public void sendBoardNotification(Comment comment, Member writer) {
Notification notification = Notification.builder()
.setTitle(FRIENDSHIP_TITLE)
Expand All @@ -53,6 +55,7 @@ public void sendBoardNotification(Comment comment, Member writer) {
// sendSingleFcm(message);
}

@Async
public void sendBoardNotification(Comment comment, List<Member> writers) {
Notification notification = Notification.builder()
.setTitle(FRIENDSHIP_TITLE)
Expand All @@ -69,6 +72,7 @@ public void sendBoardNotification(Comment comment, List<Member> writers) {
}
}

@Async
public void sendChatMessage(com.aliens.backend.chat.domain.Message message) {
var fcmMessage = createFcmMessage(message);
// sendSingleFcm(fcmMessage);
Expand Down Expand Up @@ -105,6 +109,7 @@ private void sendSingleFcm(Message message) {
}
}

@Async
public void sendMatchedNotification(Set<Member> members) {
List<String> tokens = members.stream().map(this::findFcmTokenByMember).toList();
Notification notification = Notification.builder()
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ spring:
logging:
level:
org.springframework.web.socket.config.WebSocketMessageBrokerStats: ERROR
root: info
config: classpath:logback-spring.xml

websocket:
port: 8080
endpoint: /ws
topic: /room
request: /chat

57 changes: 0 additions & 57 deletions src/main/resources/log/config/error-config.xml

This file was deleted.

52 changes: 0 additions & 52 deletions src/main/resources/log/config/info-config.xml

This file was deleted.

61 changes: 0 additions & 61 deletions src/main/resources/log/config/warn-config.xml

This file was deleted.

35 changes: 0 additions & 35 deletions src/main/resources/logback-dev.xml

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/resources/logback-prod.xml

This file was deleted.

Loading
Loading