Skip to content

Commit 5a49511

Browse files
committed
remove to_json from connection
1 parent e9e3fb6 commit 5a49511

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

lib/async/container/supervisor/connection.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Released under the MIT License.
44
# Copyright, 2025, by Samuel Williams.
55

6-
require "json"
76
require "async"
87
require_relative "message_wrapper"
98

@@ -14,8 +13,6 @@ module Supervisor
1413
#
1514
# Handles message passing, call/response patterns, and connection lifecycle.
1615
class Connection
17-
MAX_MESSAGE_SIZE = 2 ** 32 - 1
18-
1916
# Represents a remote procedure call over a connection.
2017
#
2118
# Manages the call lifecycle, response queueing, and completion signaling.
@@ -40,13 +37,6 @@ def as_json(...)
4037
@message
4138
end
4239

43-
# Convert the call to a JSON string.
44-
#
45-
# @returns [String] The JSON representation.
46-
def to_json(...)
47-
as_json.to_json(...)
48-
end
49-
5040
# @attribute [Connection] The connection that initiated the call.
5141
attr :connection
5242

lib/async/container/supervisor/message_wrapper.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ def initialize(stream)
2020

2121
def write(message)
2222
data = pack(message)
23-
# Console.logger.info("Sending data: #{message.inspect}")
2423
@packer.write(data)
2524
end
2625

2726
def read
28-
data = @unpacker.read
29-
# Console.logger.info("Received data: #{data.inspect}")
30-
data
27+
@unpacker.read
3128
end
3229

3330
def pack(message)

test/async/container/connection.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ def write_message(message)
8888
with subject::Call do
8989
let(:test_call) {Async::Container::Supervisor::Connection::Call.new(connection, 1, {do: :test, data: "value"})}
9090

91-
it "can serialize call to JSON" do
92-
json = test_call.to_json
93-
parsed = JSON.parse(json)
94-
95-
expect(parsed).to have_keys(
96-
"do" => be == "test",
97-
"data" => be == "value"
98-
)
99-
end
100-
10191
it "can get call message via as_json" do
10292
expect(test_call.as_json).to have_keys(
10393
do: be == :test,

0 commit comments

Comments
 (0)