xing-gearman-ruby 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION.yml +1 -1
- data/gearman-ruby.gemspec +2 -2
- data/lib/gearman/taskset.rb +16 -7
- metadata +2 -2
data/VERSION.yml
CHANGED
data/gearman-ruby.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{gearman-ruby}
|
5
|
-
s.version = "1.3.
|
5
|
+
s.version = "1.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Daniel Erat", "Ladislav Martincik", "Pablo Delgado", "Mauro Pompilio", "Antonio Garrote", "Kim Altintop"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-06}
|
10
10
|
s.description = %q{Library for the Gearman distributed job system}
|
11
11
|
s.email = %q{ladislav.martincik@xing.com}
|
12
12
|
s.extra_rdoc_files = [
|
data/lib/gearman/taskset.rb
CHANGED
@@ -225,12 +225,21 @@ class TaskSet
|
|
225
225
|
# Wait for all tasks in the set to finish.
|
226
226
|
#
|
227
227
|
# @param timeout maximum amount of time to wait, in seconds
|
228
|
-
def wait(timeout=1)
|
229
|
-
end_time =
|
228
|
+
def wait(timeout = 1)
|
229
|
+
end_time = if timeout
|
230
|
+
Time.now.to_f + timeout
|
231
|
+
else
|
232
|
+
nil
|
233
|
+
end
|
234
|
+
|
230
235
|
while not @tasks_in_progress.empty?
|
231
|
-
remaining = end_time
|
232
|
-
|
233
|
-
|
236
|
+
remaining = if end_time
|
237
|
+
(t = end_time - Time.now.to_f) > 0 ? t : 0
|
238
|
+
else
|
239
|
+
nil
|
240
|
+
end
|
241
|
+
|
242
|
+
ready_socks = IO::select(@sockets.values, nil, nil, remaining)
|
234
243
|
if not ready_socks or not ready_socks[0]
|
235
244
|
Util.log "Timed out while waiting for tasks to finish"
|
236
245
|
# not sure what state the connections are in, so just be lame and
|
@@ -241,7 +250,7 @@ class TaskSet
|
|
241
250
|
end
|
242
251
|
ready_socks[0].each do |sock|
|
243
252
|
begin
|
244
|
-
read_packet(sock, end_time - Time.now.to_f)
|
253
|
+
read_packet(sock, (end_time ? end_time - Time.now.to_f : nil))
|
245
254
|
rescue ProtocolError
|
246
255
|
hostport = @client.get_hostport_for_socket(sock)
|
247
256
|
Util.log "Ignoring bad packet from #{hostport}"
|
@@ -261,7 +270,7 @@ class TaskSet
|
|
261
270
|
end
|
262
271
|
true
|
263
272
|
end
|
264
|
-
|
273
|
+
|
265
274
|
private
|
266
275
|
def tasks_in_progress(hostport, handle, remove_task = false)
|
267
276
|
js_handle = Util.handle_to_str(hostport, handle)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xing-gearman-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Erat
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2009-08-
|
17
|
+
date: 2009-08-06 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|