lib/gearman/worker.rb in xing-gearman-ruby-1.1.0 vs lib/gearman/worker.rb in xing-gearman-ruby-1.2.0
- old
+ new
@@ -269,19 +269,20 @@
cmd = if ret && exception.nil?
ret = ret.to_s
Util.log "Sending work_complete for #{handle} with #{ret.size} byte(s) " +
"to #{hostport}"
- Util.pack_request(:work_complete, "#{handle}\0#{ret}")
+ [ Util.pack_request(:work_complete, "#{handle}\0#{ret}") ]
elsif exception.nil?
Util.log "Sending work_fail for #{handle} to #{hostport}"
- Util.pack_request(:work_fail, handle)
+ [ Util.pack_request(:work_fail, handle) ]
elsif exception
- Util.log "Sending work_exception for #{handle} to #{hostport}"
- Util.pack_request(:work_exception, "#{handle}\0#{exception.message}")
+ Util.log "Sending work_warning, work_fail for #{handle} to #{hostport}"
+ [ Util.pack_request(:work_warning, "#{handle}\0#{exception.message}"),
+ Util.pack_request(:work_fail, handle) ]
end
- Util.send_request(sock, cmd)
+ cmd.each {|p| Util.send_request(sock, p) }
true
end
##
# Do a single job and return.