샘플
faraday 2.14.3: Show that Faraday's in_parallel does not queue requests when the adapter does not support parallel execution.
검증된 샘플 — gem faraday 2.14.3: Show that Faraday's in_parallel does not queue requests when the adapter does not support parallel execution. ruby 3 · linux…
sha256:66a93d0da5130333f48cfd5b012181a9755c13a10ceb449b8d45ee804a35bdc1
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 2
선언된 환경
ruby linux x64 ruby ruby bundler
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-17 |
| ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-18 |
케이스
HOW- 목표
- Show that Faraday's in_parallel does not queue requests when the adapter does not support parallel execution.
- 패키지
- 심벌
-
- Faraday::Connection#in_parallel
- Faraday::Adapter
- 환경
- ruby
- 생성일
- 2026-08-17T02:37:25Z
컨트랙트
- Faraday::Connection#in_parallel with a non-parallel adapter returns normal `Faraday::Response` objects and executes requests immediately, not as queued futures.
- The default connection adapter in this setup reports `supports_parallel?` as false.
- A call inside the in_parallel block is recorded as a normal request and completes with a 200 status.
파일
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- test/contract.rb
소스
source "https://rubygems.org"
gem "faraday", "2.14.3"
GEM
remote: https://rubygems.org/
specs:
faraday (2.14.3)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.4.4)
net-http (~> 0.5)
json (2.21.2)
logger (1.7.0)
net-http (0.9.1)
uri (>= 0.11.1)
uri (1.1.1)
PLATFORMS
ruby
x64-mingw-ucrt
DEPENDENCIES
faraday (= 2.14.3)
CHECKSUMS
bundler (4.0.18) sha256=02d9a17429de1847b4e0c9f27a9ee4b20c0a74c0a641b4e77195d6019e3618ac
faraday (2.14.3) sha256=1882247e6766615c8220b4392bf1d27f6ebb63d8e28267587cef1fb0bf37f278
faraday-net_http (3.4.4) sha256=0e78af151747ed1b00f33e25973b4bc220d7f16c00c39676817c8b12331eb588
json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
BUNDLED WITH
4.0.18
`search_known_solution` hit existing samples for this package, including `sha256:c50f9bbfe83d4d0f5b44242b2e1675ffca6f3c29d43f04ddd3ac9e36f0f0ce46`, which covered url_prefix and params_encoder traps.
This sample uses a different trap: `Faraday::Connection#in_parallel` with a non-parallel adapter.
{"case":{"believed":"Calling `in_parallel` on a standard Faraday connection always defers request execution and returns deferred/future responses.","caseId":"case:sha256:a4b0cad6f2f065f1ec0479d047238f69abcd846e37ceac1b5dbbd4c44c875c8a","contract":["Faraday::Connection#in_parallel with a non-parallel adapter returns normal `Faraday::Response` objects and executes requests immediately, not as queued futures.","The default connection adapter in this setup reports `supports_parallel?` as false.","A call inside the in_parallel block is recorded as a normal request and completes with a 200 status."],"goal":"Show that Faraday's in_parallel does not queue requests when the adapter does not support parallel execution.","kind":"HOW","packages":["pkg:gem/faraday@2.14.3"],"schemaVersion":1,"symbols":["Faraday::Connection#in_parallel","Faraday::Adapter"]},"contractCommand":["ruby","test/contract.rb"],"environment":{"arch":"x64","ecosystem":"gem","executionContext":"ruby","language":"ruby","os":"linux","packageManager":"bundler","runtime":"ruby","schemaVersion":1},"license":"MIT-0","packages":["pkg:gem/faraday@2.14.3"],"schemaVersion":1,"symbols":["Faraday::Connection#in_parallel","Faraday::Adapter"],"verifierAdapter":"rubygems@1"}
# frozen_string_literal: true
require 'faraday'
class CaptureAdapter < Faraday::Adapter
@requests = []
def self.requests
@requests
end
def self.reset!
@requests = []
end
def self.record!(value)
@requests << value
end
def self.count
@requests.length
end
def call(env)
self.class.record!(env.url.request_uri)
super
save_response(env, 200, env.url.request_uri, { 'x-test' => 'capture' })
end
end
CaptureAdapter.reset!
connection = Faraday.new('http://example.com') do |builder|
builder.adapter(CaptureAdapter)
end
unless connection.adapter.klass.respond_to?(:supports_parallel?) && connection.adapter.klass.supports_parallel? == false
raise 'Expected CaptureAdapter to not advertise parallel support'
end
responses = []
in_parallel_result = nil
connection.in_parallel do
responses << connection.get('/first')
responses << connection.get('/second')
in_parallel_result = responses.last
end
unless responses.all? { |response| response.is_a?(Faraday::Response) }
raise 'Expected in_parallel to return immediate Faraday::Response objects'
end
unless CaptureAdapter.count == 2
raise "Expected CaptureAdapter to run both requests; got #{CaptureAdapter.count}"
end
unless responses.all? { |response| response.body == '/first' || response.body == '/second' }
raise "Unexpected in_parallel responses: #{responses.map(&:body).inspect}"
end
unless in_parallel_result.is_a?(Faraday::Response) && in_parallel_result.body == '/second'
raise "Unexpected in_parallel return value: #{in_parallel_result&.body.inspect}"
end