klepto 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -62,7 +62,11 @@ EOS
62
62
 
63
63
  # This is here to debug, having a weird issue with getting a 200 and sometimes
64
64
  # returning @browser.failure? => true
65
- sleep 1
65
+ sleep_counter = 0
66
+ while @browser.status.nil? && sleep_counter < @config.sleep_tries
67
+ sleep_counter +=1
68
+ sleep @config.sleep
69
+ end
66
70
 
67
71
  # If the page was not a failure or if not aborting, structure that bad boy.
68
72
  if (@browser.failure? && @config.abort_on_failure?)
@@ -6,6 +6,8 @@ module Klepto
6
6
  def initialize
7
7
  @headers = {}
8
8
  @abort_on_failure = true
9
+ @sleep = 0.5
10
+ @sleep_tries = 10
9
11
  @abort_on_redirect = false
10
12
  @after_handlers = {
11
13
  :structure => [], #after each call to
@@ -24,6 +26,14 @@ module Klepto
24
26
  # @handlers[group][handler].each{|handler| handler.call(*args)}
25
27
  # end
26
28
 
29
+ def sleep(_sleep=nil)
30
+ @sleep = _sleep
31
+ end
32
+
33
+ def sleep_tries(_sleep_tries=nil)
34
+ @sleep_tries = _sleep_tries
35
+ end
36
+
27
37
  def driver(_driver=nil)
28
38
  @default_driver = _driver if _driver
29
39
  @default_driver
@@ -1,3 +1,3 @@
1
1
  module Klepto
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klepto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.7
4
+ version: 0.6.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: