Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

Method createPayload signature of IronQueue is different then the parent #28

Closed
brseixas opened this issue Oct 10, 2018 · 1 comment
Closed

Comments

@brseixas
Copy link

brseixas commented Oct 10, 2018

Hello, first of all thank you for the driver as it allows to usage of Iron queues easily in a laravel application. While working on a laravel 5.7 application I noticed what it seems a possible bug.

Stack

  • PHP 7.2
  • Laravel 5.7

issue:

  • the createPayloadArray method calls the parent::createPayloadArray, and its passing the method parameters in a different order.

Current the signature in IronQueue is:

  • protected function createPayloadArray($job, $data = '', $queue = null)

and the parent one is:

  • protected function createPayloadArray($job, $queue, $data = '')

This results in the payload being incorrectly generated, which will make the job process fail.

Fix suggestion:

On IronQueue, the push method would be changed to:

  public function push($job, $data = '', $queue = null)
    {
        return $this->pushRaw($this->createPayload($job, $queue, $data), $queue);
    }

On IronQueue, the later method would be changed to:

   public function later($delay, $job, $data = '', $queue = null)
    {
        $delay = $this->secondsUntil($delay);

        $payload = $this->createPayload($job, $queue, $data);

        return $this->pushRaw($payload, $queue, compact('delay'));
    }

On IronQueue, the createPayloadArray method would be changed to:

protected function createPayloadArray($job, $queue, $data = '')
    {
        return array_merge(parent::createPayloadArray($job, $queue, $data), [
            'queue' => $this->getQueue($queue),
        ]);
    }

The payload is generated correctly which allows the job to be process as expected.

Once again, thanks for the good work and I hope this helps.

@brseixas brseixas changed the title Method createPayload signature on IronQueue is different then the parent On Laravel 5.7, method createPayload signature of IronQueue is different then the parent Oct 10, 2018
@brseixas brseixas changed the title On Laravel 5.7, method createPayload signature of IronQueue is different then the parent Method createPayload signature of IronQueue is different then the parent Oct 10, 2018
@trideout
Copy link
Collaborator

This should be resolved in the latest tagged release of the package, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants