Sha256: 8c64ee3423cea57c0a0f0fb22c5d7f0c02f3dd14ce25777cc9b50fe633507ee2

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

require "socket"

module RSpec
  module Parallel
    class SocketBuilder
      def initialize(path)
        @path = path
      end

      # @return [BasicSocket, nil]
      def run(retry_counter = 3)
        build
      rescue
        retry_counter -= 1
        if retry_counter > 0
          sleep rand
          retry
        end
        nil
      end

      private

      # @return [UNIXSocket]
      def build
        ::UNIXSocket.new(path)
      end

      # @return [String]
      attr_reader :path
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parallel-rspec-0.1.1 lib/rspec/parallel/socket_builder.rb
parallel-rspec-0.1.0 lib/rspec/parallel/socket_builder.rb