app/models/extface/driver.rb in extface-0.4.1b vs app/models/extface/driver.rb in extface-0.4.2a
- old
+ new
@@ -45,18 +45,18 @@
end
def push(buffer)
if @job
#retry if current device job is not @job (waiting on queue)
- wait_on_queue = 20 #stop me writing endless things
- begin
- if current_device_job = device.jobs(true).active.try(:first)
- if current_device_job != @job
- #wait_on_queue = 20 #FIXME!
- p "#### current_job is not first_on_queue"
- end
+ wait_on_queue = 2 #stop me writing endless things
+ if current_device_job = device.jobs(true).active.try(:first)
+ if current_device_job != @job
+ wait_on_queue = 20 #FIXME!
+ p "#### current_job is not first_on_queue"
end
+ end
+ begin
Timeout.timeout(Extface.device_timeout) do
Extface.redis_block do |r|
r.subscribe(@job.id) do |on| #blocking until delivered
on.subscribe do |channel, subscriptions|
@job.rpush buffer
@@ -68,10 +68,10 @@
end
end
end
end
rescue Timeout::Error
- (wait_on_queue -= 1) > 0 ? retry : raise(e) #let it be!
+ (wait_on_queue -= 1) > 0 ? retry : raise("Timeout waiting on queue") #let it be!
end
else
raise "No job given"
end
end