Class: Mediaflux::HttpConnection

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
app/models/mediaflux/http_connection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHttpConnection

Returns a new instance of HttpConnection.



18
19
20
21
22
23
24
25
# File 'app/models/mediaflux/http_connection.rb', line 18

def initialize
  @http_client = Net::HTTP::Persistent.new
  Rails.logger.debug "created http"
  # https is not working correctly on td-meta1 we should not need this, but we do...
  @http_client.verify_mode = OpenSSL::SSL::VERIFY_NONE

  ObjectSpace.define_finalizer(self, self.class.finalizer(@http_client))
end

Instance Attribute Details

#http_clientObject (readonly)

Returns the value of attribute http_client.



6
7
8
# File 'app/models/mediaflux/http_connection.rb', line 6

def http_client
  @http_client
end

Class Method Details

.finalizer(http_client) ⇒ Object



10
11
12
13
14
15
# File 'app/models/mediaflux/http_connection.rb', line 10

def finalizer(http_client)
  proc {
    Rails.logger.debug "finalized http"
    http_client&.shutdown
  }
end