brandonhilkert / sucker_punch

Sucker Punch is a Ruby asynchronous processing library using concurrent-ruby, heavily influenced by Sidekiq and girl_friday.
MIT License
2.64k stars 114 forks source link

Reloading changes in jobs folder? #35

Closed drewhamlett closed 11 years ago

drewhamlett commented 11 years ago

I'm not sure this is a sucker punch thing or a Rails thing. Rails should reload all classes under the app folder and I have an app/jobs folder. I can't get changes in a job class to reload across a request.

I have a class

class DeviseEmailJob
    include SuckerPunch::Job

    def perform(notification, user_id, opts)
        ActiveRecord::Base.connection_pool.with_connection do
            user = User.find(user_id)
            Devise.mailer.send(notification, user, opts).deliver
        end
    end
end

Then in my user.rb


    def send_devise_notification(notification, opts={})
        DeviseEmailJob.new.async.perform(notification, self.id, opts)
    end

Now if I make a change in DeviseEmailJob I have to stop and start rails for it to see it. Simply reloading the page doesn't do anything.

Thanks for any help!

brandonhilkert commented 11 years ago

Autoloading code is not thread safe.