mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-26 19:21:43 +00:00
[SIS-14] adding the on message in its own thread
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static dev.sheldan.sissi.module.debra.config.DebraFeatureConfig.DEBRA_DONATION_NOTIFICATION_DELAY_CONFIG_KEY;
|
||||
@@ -40,6 +41,7 @@ public class WebsocketListener extends WebSocketListener implements AsyncStartup
|
||||
|
||||
@Override
|
||||
public void onMessage(WebSocket webSocket, String text) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
log.info("Handling received message on websocket.");
|
||||
try {
|
||||
Long targetServerId = Long.parseLong(System.getenv(DEBRA_DONATION_NOTIFICATION_SERVER_ID_ENV_NAME));
|
||||
@@ -57,6 +59,7 @@ public class WebsocketListener extends WebSocketListener implements AsyncStartup
|
||||
} catch (Exception exception) {
|
||||
log.error("Failed to handle websocket message.", exception);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user