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

Resque.inline describe the error! #1026

Closed
tumayun opened this Issue May 29, 2013 · 6 comments

Comments

Projects
None yet
3 participants
@tumayun

tumayun commented May 29, 2013

https://github.com/resque/resque/blob/master/lib/resque.rb#L119

# If 'inline' is true Resque will call #perform method inline
# without queuing it into Redis and without any Resque callbacks.
# The 'inline' is false Resque jobs will be put in queue regularly.
attr_writer :inline

https://github.com/resque/resque/blob/master/lib/resque/job_performer.rb#L12

# This is the actual performer for a single unit of work.  It's called
# by Resque::Job#perform
# Args:
#   palyoad_class: The class to call ::perform on
#   args: An array of args to pass to the payload_class::perform
#   hook: A hash with keys :before, :after and :around, all arrays of
#         methods to call on the payload class with args
def perform(payload_class, args, hooks)
  @job      = payload_class
  @job_args = args || []
  @hooks    = hooks

  # before_hooks can raise a Resque::DontPerform exception
  # in which case we exit this method, returning false (because
  # the job was never performed)
  return false unless call_before_hooks
  execute_job
  call_hooks(:after)

  performed?
end

The Resque :: JobPerformer # perform method will go to execute callbacks!
But inline said not to execute callbacks.
Why?

@tumayun

This comment has been minimized.

Show comment
Hide comment
@tumayun

tumayun May 29, 2013

AT master

tumayun commented May 29, 2013

AT master

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik May 29, 2013

Member

Because the docs are wrong! :(

I'm not sure which behavior we actually want.

Member

steveklabnik commented May 29, 2013

Because the docs are wrong! :(

I'm not sure which behavior we actually want.

@tumayun

This comment has been minimized.

Show comment
Hide comment
@tumayun

tumayun May 30, 2013

@steveklabnik Aha, future versions inline to true will execute hooks?

tumayun commented May 30, 2013

@steveklabnik Aha, future versions inline to true will execute hooks?

@steveklabnik

This comment has been minimized.

Show comment
Hide comment
@steveklabnik

steveklabnik May 30, 2013

Member

I'm not sure.

Member

steveklabnik commented May 30, 2013

I'm not sure.

@tumayun

This comment has been minimized.

Show comment
Hide comment
@tumayun

tumayun May 30, 2013

ok, thanks!

tumayun commented May 30, 2013

ok, thanks!

@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Feb 18, 2018

Contributor

Inline does execute hooks since #506.

Contributor

jeremy commented Feb 18, 2018

Inline does execute hooks since #506.

@jeremy jeremy closed this Feb 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment