Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an explicit way to release a job with new :pri or :delay #1

Open
rewritten opened this issue Nov 7, 2011 · 0 comments
Open

Comments

@rewritten
Copy link

If for some reason (external and temporary) a job needs to be released, there could be a way (other than raising an Interrupt) to catch some exception and interpreting it as to release the job with specific options.

This should go with a way to distinguish in code whether it's executed by the worker or by passenger/whatever, as in the following example code

module AsyncMethods
  def anything(*args)
    do_something
  rescue => some_controlled_situation
    if defined(ASYNC_OBSERVER_WORKER)
      raise AsyncObserver::Release :delay => 10
    else
      async_send_opts :anything, {:delay => 10}, args
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant