Sha256: cb2cc7c25544da8e2bd5ee78fb0f5c7858dde723de961b695b7095f7944e0d74

Contents?: true

Size: 694 Bytes

Versions: 1

Compression:

Stored size: 694 Bytes

Contents

module Fog
  module AWS
    class Storage
      class Real
        # Sync clock against S3 to avoid skew errors
        #
        def sync_clock
          response = begin
            Excon.get(sync_clock_url)
          rescue Excon::Errors::HTTPStatusError => error
            error.response
          end
          Fog::Time.now = Time.parse(response.headers['Date'])
        end

        private

        def sync_clock_url
          host = @acceleration ? region_to_host(@region) : @host

          "#{@scheme}://#{host}"
        end
      end # Real

      class Mock # :nodoc:all
        def sync_clock
          true
        end
      end # Mock
    end # Storage
  end # AWS
end # Fog

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-aws-3.19.0 lib/fog/aws/requests/storage/sync_clock.rb