Skip to content

Commit

Permalink
Fix compatibility with io-stream changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Oct 15, 2024
1 parent e7814e1 commit 89336da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/falcon/command/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class Metrics < Samovar::Command

# Send the metrics message to the supervisor and print the results.
def call(stream)
stream.puts({please: 'metrics'}.to_json, separator: "\0")
response = JSON.parse(stream.gets("\0"), symbolize_names: true)
stream.puts({please: 'metrics'}.to_json, separator: "\0", chomp: true)
response = JSON.parse(stream.read_until("\0"), symbolize_names: true)

$stdout.puts response
end
Expand Down
4 changes: 2 additions & 2 deletions lib/falcon/service/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setup(container)
@bound_endpoint.accept do |peer|
stream = ::IO::Stream(peer)

while message = stream.gets("\0")
while message = stream.read_until("\0")
response = handle(JSON.parse(message, symbolize_names: true))
stream.puts(response.to_json, separator: "\0")
end
Expand All @@ -101,7 +101,7 @@ def invoke(command)

stream.puts(command.to_json, separator: "\0")

response = JSON.parse(stream.gets("\0"), symbolize_names: true)
response = JSON.parse(stream.read_until("\0"), symbolize_names: true)

return response
end
Expand Down

0 comments on commit 89336da

Please sign in to comment.