diff --git a/lib/runner/connection.rb b/lib/runner/connection.rb index 150c7cb5..87f59aac 100644 --- a/lib/runner/connection.rb +++ b/lib/runner/connection.rb @@ -18,11 +18,7 @@ class Runner::Connection def initialize(url, strategy, event_loop, locale = I18n.locale) Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Opening connection to #{url}" } - # The `ping` value is measured in seconds and specifies how often a Ping frame should be sent. - # Internally, Faye::WebSocket uses EventMachine and the `ping` value is used to wake the EventMachine thread - # The `tls` option is used to customize the validation of TLS connections. - # Passing `nil` as a `root_cert_file` is okay and done so for the DockerContainerPool. - @socket = Faye::WebSocket::Client.new(url, [], strategy.class.websocket_header.merge(ping: 0.1)) + @socket = Faye::WebSocket::Client.new(url, [], strategy.class.websocket_header) @strategy = strategy @status = :established @event_loop = event_loop diff --git a/lib/runner/strategy/docker_container_pool.rb b/lib/runner/strategy/docker_container_pool.rb index 72b76d92..fe45d23c 100644 --- a/lib/runner/strategy/docker_container_pool.rb +++ b/lib/runner/strategy/docker_container_pool.rb @@ -129,7 +129,11 @@ class Runner::Strategy::DockerContainerPool < Runner::Strategy end def self.websocket_header - {} + # The `ping` value is measured in seconds and specifies how often a Ping frame should be sent. + # Internally, Faye::WebSocket uses EventMachine and the `ping` value is used to wake the EventMachine thread + { + ping: 0.1, + } end private diff --git a/lib/runner/strategy/poseidon.rb b/lib/runner/strategy/poseidon.rb index 781a4b2a..cabda9f5 100644 --- a/lib/runner/strategy/poseidon.rb +++ b/lib/runner/strategy/poseidon.rb @@ -118,6 +118,8 @@ class Runner::Strategy::Poseidon < Runner::Strategy end def self.websocket_header + # The `tls` option is used to customize the validation of TLS connections. + # The `headers` option is used to pass the `Poseidon-Token` as part of the initial connection request. { tls: {root_cert_file: config[:ca_file]}, headers: {'Poseidon-Token' => config[:token]},