Итак, у меня есть код, часть задачи rake:
class DrivingStatJob < DBJob
sidekiq_options :queue => :driving_stats, :backtrace => true
def perform(work_order_id)
Rails.logger.info "Calculating driving stats for work_order #{work_order_id}"
begin
work_order = WorkOrder.find(work_order_id)
return unless work_order.steps.size > 1
DrivingStat.calculate!(work_order.steps.first.location.address, work_order.steps.last.location.address)
rescue DrivingStatService::MissingCoordinatesError
Rails.logger.warn "Unable to fetch coorindates for work order #{work_order_id}"
rescue ActiveRecord::RecordInvalid => e
Rails.logger.warn "Unable to save driving stat: #{e.message}"
rescue ActiveRecord::RecordNotFound
# Ignore
rescue RuntimeError => e
Rails.logger.warn "Unable to compute driving directions"
Rails.logger.warn [e.message, e.backtrace].join("\n")
end
end
end
Код, который вызывает «выполнение»:
begin
DrivingStatJob.perform_async(id) if changed
rescue Redis::CannotConnectError => e
logger.warn "Unable to queue up driving stats job"
logger.warn [e.message, e.backtrace].join("\n")
end
Проблема: зависает на DrivingStatJob.perform_async(id)
. Просто висит без ошибок. Нет сообщений журнала от функции «выполнить». Что это может быть? Redis работает без ошибок, sidekiq работает без ошибок. Redis работает на 127.0.0.1:6379, Sidekiq показывает, что знает, что Redis там есть.
Linux Mint 15, Ruby 1.9.3, Redis 2.6, sidekiq-2.14.
id
представляет собой большую структуру данных, а не целочисленное значение? - person iltempo   schedule 21.09.2013DrivingStatJob.perform(id)
- person iltempo   schedule 21.09.2013