You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
APN.password=ENV['CERT_PASS']APN.full_certificate_path=ENV['FULL_CERT_PATH']APN.logger=Rails.loggerworker= ::Resque::Worker.new(APN::Jobs::QUEUE_NAME)puts"*** Starting worker to send apple notifications in the background from #{worker}"worker.work(ENV['INTERVAL'] || 5)# interval, will block
This starts just fine. However...
require 'apn/jobs/resque_notification_job' is now run inside the backend method.
The queue uses the job class APN::Jobs::ResqueNotificationJob.
So, since we've never called APN.backend in this worker (and we shouldn't have to do that!), the first queue item will crash when attempting to reference the un-loaded ResqueNotificationJob class.
I think the solution should load the job classes up front, rather than requiring a backend (which the workers won't even use) to be created.
How do you feel about trying to require both sidekiq and resque, like below?
Let's look at the example from
apn/tasks
:This starts just fine. However...
require 'apn/jobs/resque_notification_job'
is now run inside thebackend
method.APN::Jobs::ResqueNotificationJob
.So, since we've never called
APN.backend
in this worker (and we shouldn't have to do that!), the first queue item will crash when attempting to reference the un-loaded ResqueNotificationJob class.I think the solution should load the job classes up front, rather than requiring a backend (which the workers won't even use) to be created.
How do you feel about trying to require both sidekiq and resque, like below?
This solves my problems, although it feels a little less than clean. If it's fine with you, I'll send a pull request.
The text was updated successfully, but these errors were encountered: