So, I have a code, part of a rake task:
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
The code which calls "perform":
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
The problem: it hangs on the DrivingStatJob.perform_async(id)
. It just hangs, without error. No log messages from "perform" function. What it could be? Redis is up without errors, sidekiq is up without errors. Redis is running on 127.0.0.1:6379, Sidekiq shows that it knows that Redis is there.
Linux Mint 15, Ruby 1.9.3, Redis 2.6, sidekiq-2.14.
The issue was in Redis config. It used Sentinel, turning Sentinel off for the development solved it.