simple_worker 2.0.6 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -86,8 +86,9 @@ module SimpleWorker
86
86
  gem_name =(gem_info[:name].match(/^[a-zA-Z0-9\-_]+/)[0])
87
87
  #puts "Searching for #{gem_name}..."
88
88
  gems= Gem::Specification.respond_to?(:each) ? Gem::Specification.find_all_by_name(gem_name) : Gem::GemPathSearcher.new.find_all(gem_name)
89
- # gems = searcher.init_gemspecs.select { |gem| gem.name==gem_name }
90
- gems = Gem::GemPathSearcher.new.init_gemspecs.select { |gem| gem.name==gem_name } if !gems || gems.empty?
89
+ if (!Gem::GemPathSearcher.private_instance_methods.include?(:_deprecated_initialize)) && (!gems || gems.empty?)
90
+ gems = Gem::GemPathSearcher.new.init_gemspecs.select { |gem| gem.name==gem_name }
91
+ end
91
92
  SimpleWorker.logger.debug 'gems found=' + gems.inspect
92
93
  gems = gems.select { |g| g.version.version==gem_info[:version] } if gem_info[:version]
93
94
  if !gems.empty?
@@ -53,6 +53,13 @@ module Uber
53
53
  end
54
54
  end
55
55
 
56
+ class TyphoeusTimeoutError < TimeoutError
57
+ def initialize(response)
58
+ msg ||= "HTTP Request Timed out. Curl code: #{response.curl_return_code}. Curl error msg: #{response.curl_error_message}."
59
+ super(msg)
60
+ end
61
+ end
62
+
56
63
  class Client
57
64
 
58
65
  def initialize
@@ -61,12 +68,13 @@ module Uber
61
68
 
62
69
  def get(url, req_hash={})
63
70
  if Uber.gem == :typhoeus
64
- req_hash[:timeout] ||= 5000
71
+ req_hash[:connect_timeout] = 1000
72
+ req_hash[:timeout] ||= 10000
65
73
  # puts "REQ_HASH=" + req_hash.inspect
66
74
  response = Typhoeus::Request.get(url, req_hash)
67
75
  #p response
68
76
  if response.timed_out?
69
- raise TimeoutError
77
+ raise TyphoeusTimeoutError.new(response)
70
78
  end
71
79
  else
72
80
  begin
@@ -84,12 +92,13 @@ module Uber
84
92
  def post(url, req_hash={})
85
93
  if Uber.gem == :typhoeus
86
94
  # todo: should change this timeout to longer if it's for posting file
87
- req_hash[:timeout] ||= 5000
95
+ req_hash[:connect_timeout] = 1000
96
+ req_hash[:timeout] ||= 10000
88
97
  # puts "REQ_HASH=" + req_hash.inspect
89
98
  response = Typhoeus::Request.post(url, req_hash)
90
99
  #p response
91
100
  if response.timed_out?
92
- raise TimeoutError
101
+ raise TyphoeusTimeoutError.new(response)
93
102
  end
94
103
  else
95
104
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-21 00:00:00.000000000 Z
12
+ date: 2011-11-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: zip
16
- requirement: &20270500 !ruby/object:Gem::Requirement
16
+ requirement: &17865380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *20270500
24
+ version_requirements: *17865380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &20269120 !ruby/object:Gem::Requirement
27
+ requirement: &17918820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *20269120
35
+ version_requirements: *17918820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: zip
38
- requirement: &20267640 !ruby/object:Gem::Requirement
38
+ requirement: &17917740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *20267640
46
+ version_requirements: *17917740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rest-client
49
- requirement: &20326780 !ruby/object:Gem::Requirement
49
+ requirement: &17930180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *20326780
57
+ version_requirements: *17930180
58
58
  description: The official SimpleWorker gem for http://www.simpleworker.com
59
59
  email: travis@appoxy.com
60
60
  executables: []
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  requirements: []
99
99
  rubyforge_project:
100
- rubygems_version: 1.8.11
100
+ rubygems_version: 1.8.8
101
101
  signing_key:
102
102
  specification_version: 3
103
103
  summary: The official SimpleWorker gem for http://www.simpleworker.com