Skip to content

Commit

Permalink
🐛 Fixed oom error when serializing large payload #242
Browse files Browse the repository at this point in the history
  • Loading branch information
MisakaTAT committed Sep 11, 2024
1 parent 0c9dc8f commit 25cc3ed
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mikuac.shiro.common.utils;

import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.JSONWriter;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.socket.TextMessage;
Expand Down Expand Up @@ -39,7 +40,7 @@ public PayloadSender(WebSocketSession session, int timeout) {
public JSONObject send(@NonNull JSONObject payload) {
lock.lock();
try {
String json = payload.toJSONString();
String json = payload.toJSONString(JSONWriter.Feature.LargeObject);
session.sendMessage(new TextMessage(json));
log.debug("[Action] {}", json);
long startTime = System.currentTimeMillis();
Expand Down

0 comments on commit 25cc3ed

Please sign in to comment.