mmucklo / DtcQueueBundle

Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}
MIT License
120 stars 38 forks source link

Beanstalkd Error #129

Closed astrogin closed 4 years ago

astrogin commented 4 years ago

Hello. pheanstalk version ^4.0 doesn't support the method putInTube. But in new versions of the package, it still using.

public function putInTube(
        $tube,
        $data,
        $priority = PheanstalkInterface::DEFAULT_PRIORITY,
        $delay = PheanstalkInterface::DEFAULT_DELAY,
        $ttr = PheanstalkInterface::DEFAULT_TTR
    ) {
        $this->useTube($tube);
        return $this->put($data, $priority, $delay, $ttr);
    }

The package part

namespace Dtc\QueueBundle\Beanstalkd;

class JobManager extends RetryableJobManager
{
.......

protected function putJob(Job $job)
    {
        /** @var Job $job */
        $message = $job->toMessage();
        $arguments = [$message];
        if (null !== $job->getPriority()) {
            $arguments[] = $job->getPriority();
        }
        if (null !== $job->getDelay()) {
            while (count($arguments) < 2) {
                $arguments[] = 0;
            }
            $arguments[] = $job->getDelay();
        }
        if (null !== $job->getTtr()) {
            while (count($arguments) < 3) {
                $arguments[] = 0;
            }
            $arguments[] = $job->getTtr();
        }
        $method =  'put';
        if ($this->tube) {
            array_unshift($arguments, $this->tube);
            $method .= 'InTube';
        }
        $beanJob = call_user_func_array([$this->beanstalkd, $method], $arguments);
        $job->setId($beanJob->getId());
        $job->setBeanJob($beanJob);

        return $job;
    }
......
}
mmucklo commented 4 years ago

@astrogin Thanks for letting me know. I'll try to take a look today or maybe tonight.

mmucklo commented 4 years ago

Fixed.