Class: BlackStack::Proxy
Overview
proxy almacenado en la base de datos
Class Method Summary collapse
- .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) ⇒ Object
- .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) ⇒ Object
Instance Method Summary collapse
-
#endJob(id_object, result, description, records_before_long_sleep) ⇒ Object
TODO: Reemplazar el parametro records_before_long_sleep por un registro en la tabla PARAMS.
- #startJob ⇒ Object
Methods included from BaseProxy
#chrome_switches, #firefox_profile_parameter, #phantomjs_switches
Class Method Details
.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) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/proxy.rb', line 11 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) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/proxy.rb', line 34 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 |
Instance Method Details
#endJob(id_object, result, description, records_before_long_sleep) ⇒ Object
TODO: Reemplazar el parametro records_before_long_sleep por un registro en la tabla PARAMS
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/proxy.rb', line 63 def endJob(id_object, 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_object}', " + "#{result.to_s}, " + "'#{description.to_s}', " + "#{records_before_long_sleep.to_s} " ) =end end |
#startJob ⇒ Object
58 59 60 |
# File 'lib/proxy.rb', line 58 def startJob() DB.execute("UPDATE proxy SET reservation_start_time=GETDATE() WHERE [id]='#{self.id}'") end |