brandonhilkert / sucker_punch

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

shutdown_timeout not working properly with `perform_in` #188

Closed danielmyasnikov closed 7 years ago

danielmyasnikov commented 7 years ago

hi @brandonhilkert ,

Great gem, thank you for the work.

Just got stuck on the issue when performing the task at a later time via rake task:

# Rakefile
class TextJob
  include SuckerPunch::Job

  def perform
    $logger.debug "performing..."
  end
end

task :test do
  TextJob.perform_in(5)
end

It doesn't output any result to a debugging logfile, because of https://github.com/brandonhilkert/sucker_punch/blob/master/lib/sucker_punch.rb#L53

Is it the desired behaviour? and a workaround would be to add a Concurrent::CountDownLatch.new.wait(MAX_EXECUTION_TIME)?

Note Also tried to perform jobs asynchronously, which works fine. However I definitely need jobs to be executed with a longer gap.

brandonhilkert commented 7 years ago

Is this in context of a larger application? Is $logger defined? if so, what is it?

Happy to poke around if you send over a sample repo. Out of curiosity, if it's kicked off from a rake task, why not run inline?

The shutdown behavior was carefully designed for the common use-case (heroku).