class BlackStack::Proxy

proxy almacenado en la base de datos

Public Class Methods

availablesWithStealth( process, discretion_seconds_to_wait_if_proxy_has_been_reserved_but_didnt_finish, discretion_seconds_to_wait_if_proxy_has_finished_successfully, discretion_seconds_to_wait_if_proxy_has_been_blocked, discretion_seconds_to_wait_for_long_sleep, discretion_stop_from, discretion_stop_until ) click to toggle source

TODO: deprecated

# File lib/proxy.rb, line 12
def self.availablesWithStealth(
      process, 
      discretion_seconds_to_wait_if_proxy_has_been_reserved_but_didnt_finish, 
      discretion_seconds_to_wait_if_proxy_has_finished_successfully,
      discretion_seconds_to_wait_if_proxy_has_been_blocked,
      discretion_seconds_to_wait_for_long_sleep,
      discretion_stop_from,
      discretion_stop_until
    )
    
  q =
    "SELECT COUNT(*) c FROM dbo.fnProxyDiscretion(" +
    "'#{process}', " +
    "#{discretion_seconds_to_wait_if_proxy_has_been_reserved_but_didnt_finish.to_s}, " +
    "#{discretion_seconds_to_wait_if_proxy_has_finished_successfully.to_s}, " +
    "#{discretion_seconds_to_wait_if_proxy_has_been_blocked.to_s}, " +
    "#{discretion_seconds_to_wait_for_long_sleep.to_s}, " +
    "'#{discretion_stop_from.to_s}', " +
    "'#{discretion_stop_until.to_s}')"
  
  return DB[q].first[:c].to_i
end
getWithStealth( process, discretion_seconds_to_wait_if_proxy_has_been_reserved_but_didnt_finish, discretion_seconds_to_wait_if_proxy_has_finished_successfully, discretion_seconds_to_wait_if_proxy_has_been_blocked, discretion_seconds_to_wait_for_long_sleep, discretion_stop_from, discretion_stop_until ) click to toggle source

TODO: deprecated

# File lib/proxy.rb, line 36
def self.getWithStealth(
      process, 
      discretion_seconds_to_wait_if_proxy_has_been_reserved_but_didnt_finish, 
      discretion_seconds_to_wait_if_proxy_has_finished_successfully,
      discretion_seconds_to_wait_if_proxy_has_been_blocked,
      discretion_seconds_to_wait_for_long_sleep,
      discretion_stop_from,
      discretion_stop_until
    )
  rid = guid()
  DB.execute(
    "EXEC dbo.reserveProxyWithDiscretion " +
    "'#{rid}', " +
    "'#{process}', " +
    "#{discretion_seconds_to_wait_if_proxy_has_been_reserved_but_didnt_finish.to_s}, " +
    "#{discretion_seconds_to_wait_if_proxy_has_finished_successfully.to_s}, " +
    "#{discretion_seconds_to_wait_if_proxy_has_been_blocked.to_s}, " +
    "#{discretion_seconds_to_wait_for_long_sleep.to_s}, " +
    "'#{discretion_stop_from.to_s}', " +
    "'#{discretion_stop_until.to_s}'"
  )
  BlackStack::Proxy.where(:reservation_id=>rid).first
end

Public Instance Methods

endJob(id_client, result, description, records_before_long_sleep) click to toggle source

TODO: deprecated TODO: Reemplazar el parametro records_before_long_sleep por un registro en la tabla PARAMS

# File lib/proxy.rb, line 67
    def endJob(id_client, result, description, records_before_long_sleep)
  # => #464
=begin
      DB.execute("UPDATE proxy SET reservation_end_time=GETDATE(), reservation_result='#{result.to_s}', reservation_description='#{description.to_s}' WHERE [id]='#{self.id}'")
  
      DB.execute(
        "EXEC dbo.endProxyJob " +
        "'#{self.id}', " +
        "'#{id_client}', " +
        "#{result.to_s}, " +
        "'#{description.to_s}', " +
        "#{records_before_long_sleep.to_s} "
      )
=end
    end
startJob() click to toggle source

TODO: deprecated

# File lib/proxy.rb, line 61
def startJob()
  DB.execute("UPDATE proxy SET reservation_start_time=GETDATE() WHERE [id]='#{self.id}'")
end