Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bake/async/container/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ def memory_sample(duration: 10, connection_id:)
operation = {do: :memory_sample, duration: duration}

# Use the forward operation to proxy the request to a worker:
return connection.call(do: :forward, operation: operation, connection_id: connection_id)
response = connection.call(do: :forward, operation: operation, connection_id: connection_id)

if response && response.key?(:data)
JSON.parse(response[:data], symbolize_names: true)
else
response
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/async/container/supervisor/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def do_memory_sample(call)
report = sampler.report

dump(call) do |file|
file.puts(report.to_s)
file.puts(report.to_json)
end
ensure
GC.start
Expand Down
4 changes: 4 additions & 0 deletions test/async/container/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def reader_target.dispatch(call); end

# The result should contain a report
expect(result).to have_keys(:data)

report = JSON.parse(result[:data], symbolize_names: true)

expect(report).to have_keys(:total_allocated, :total_retained, :aggregates)
ensure
worker_task&.stop
end
Expand Down
Loading