From fa66b8b983c2c382a3e93aba05534790822e47ae Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sun, 12 Jun 2022 23:22:47 +1200 Subject: [PATCH] Fix performance spec - don't use container in reactor. --- spec/async/http/performance_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/async/http/performance_spec.rb b/spec/async/http/performance_spec.rb index 5b96256d..81d737ba 100755 --- a/spec/async/http/performance_spec.rb +++ b/spec/async/http/performance_spec.rb @@ -27,8 +27,6 @@ require 'etc' RSpec.shared_examples_for 'client benchmark' do - include_context Async::RSpec::Reactor - let(:endpoint) {Async::HTTP::Endpoint.parse('http://127.0.0.1:9294', timeout: 0.8, reuse_port: true)} let(:server) do @@ -42,8 +40,10 @@ let(:concurrency) {Etc.nprocessors || 2} before do - # We bind the endpoint before running the server so that we know incoming connections will be accepted: - @bound_endpoint = Async::IO::SharedEndpoint.bound(endpoint) + Sync do + # We bind the endpoint before running the server so that we know incoming connections will be accepted: + @bound_endpoint = Async::IO::SharedEndpoint.bound(endpoint) + end # I feel a dedicated class might be better than this hack: allow(@bound_endpoint).to receive(:protocol).and_return(endpoint.protocol)