我使用redis pub/sub with resque worker,resque在第一份工作后挂起, 我的工作任务阻塞了自然。我的理解是重新为每一份新工作带来新线索。resque被工作人员的工作拦截
我的工人是如下
class SendInvitation
@queue = :outbound_dialer
def self.perform(contact_type, contact_no, invitation_audio_file)
@invitationManager = DRbObject.new_with_uri(DRB_SERVER_URL)
task_id = @invitationManager.send_invitation(contact_type, contact_no, invitation_audio_file)
puts task_id+"is the currents task id"
$redis = Redis.new(:timeout=>REDIS_TIMEOUT)
$redis.subscribe('outbound_dialer') do |on|
on.message do |channel, msg|
data = JSON.parse(msg)
if(data['id'] == task_id)
puts 'here'
@invitationManager = nil
# exit
end
end
end
end
end
PS -ef导致
这里螺纹5784阻塞resque任务,只要我杀了当前处理任务,resque与下一个任务开始,并再次在完成后开始等待 根3595 1 0 14:14? 00:00:34 /usr/bin/ruby1.9.1/usr/local/bin/resque-web root 5370 1887 0 15:40 pts/1 00:00:04 resque-2.0.0.pre.1:Forked 5784 at 1363947580 root 5784 5370 0 15:49 pts/1 00:00:00 resque-2.0.0.pre.1:处理outbound_dialer自1363947580 [SendInvitation] root 5803 2140 0 15:49 pts/2 00:00 :00的grep --color =自动resque
我已经尝试COUNT = 5
那么count = 5应该做什么。 – 2013-03-22 11:09:58
我不知道你在说什么。 – 2013-03-22 11:12:39
K我确切的要求是处理异步作业。我希望在他们入队时尽快运行它们。我整合了resqueue,以便我可以有效地处理失败的工作。所以,我使用正确的工具,否则我应该看看别的东西。 – 2013-03-22 12:59:36