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

It seems that Resque::enqueue won't return false if failed to push job to queue #330

Open
ouonet opened this issue Feb 21, 2017 · 1 comment

Comments

@ouonet
Copy link

ouonet commented Feb 21, 2017

I use dev-master in product, I found some job hasn't been pushed to queue,but Resque::enqueue() still returned a success token.
It seems that Resque::enqueue won't return false if failed to push job to queue.
I read the source code :
Job.php lines 60:
`

public static function create($queue, $class, $args = null, $monitor = false, $id = null)
{
       if (is_null($id)) {
                $id = Resque::generateJobId();
       }

      if($args !== null && !is_array($args)) {
                throw new InvalidArgumentException(
                          'Supplied $args must be an array.'
                );
      }
      Resque::push($queue, array(
                'class'	=> $class,
                'args'	=> array($args),
                'id'	=> $id,
                'queue_time' => microtime(true),
      ));
      if($monitor) {
                Resque_Job_Status::create($id);
      }
      return $id;
}

`

if Resque::push() fails , it will return false
but in this function ,it won't check if result is false.

@danhunsaker
Copy link
Contributor

Sounds like a good candidate for a PR.

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

2 participants