Skip to content

Commit

Permalink
Fix publishAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Dec 28, 2024
1 parent e052f77 commit 6e0e934
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void writeBuffer(FriendlyByteBuf dst, boolean toFile) {
}

public void writeFileStream(FileOutputStream oStream) throws IOException {
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer(256));
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer(512));
writeBuffer(buf, true);
fileOffset = oStream.getChannel().position();
oStream.write(buf.array(), 0, buf.writerIndex());
Expand Down Expand Up @@ -139,7 +139,7 @@ public JsonObject toJson() {
}

public ByteBuf toBinaryBuffer() {
FriendlyByteBuf dest = new FriendlyByteBuf(Unpooled.buffer(256));
FriendlyByteBuf dest = new FriendlyByteBuf(Unpooled.buffer(512));
dest.writeResourceLocation(level);
writeBuffer(dest, false);
return dest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public static RedisMessage update(CommentEntry entry) {
}

public void publishAsync(StatefulRedisConnection<String, ByteBuf> connection) {
ByteBuf buffer = Unpooled.buffer(content.readableBytes() + 1 + Long.BYTES);
ByteBuf buffer = Unpooled.buffer(content.readableBytes() + 16);
buffer.writeByte(action.ordinal());
buffer.writeLong(initiator);
buffer.writeInt(content.readableBytes());
buffer.writeBytes(content);
connection.async().publish(COMMAND_CHANNEL, buffer);
}

Expand Down

0 comments on commit 6e0e934

Please sign in to comment.