Skip to content

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

@rewritten

Description

@rewritten

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions