php-resque icon indicating copy to clipboard operation
php-resque copied to clipboard

Several events are not working

Open PAXANDDOS opened this issue 1 year ago • 2 comments

The issue for Resque v4 in PR #117 but probably exists in previous versions of v4 and v3

Issue

Selected events are not working: image

To reproduce

  1. Use the v4 branch (if #117 is merged)
  2. Uncomment the redis block in resque.yml, change host to redis and phpiredis to true
  3. Run docker compose up -d
  4. (terminal 1) Run docker exec resque bin/resque worker:start
  5. Create example file a.php and fill it with contents (see below)
  6. (terminal 2) Run docker exec resque php a.php

Test script

a.php

<?php

require_once 'vendor/autoload.php';

use Resque\Event;
use Resque\Resque;

Resque::loadConfig();

Event::listen('*', function (int $event) {
    $id = Event::eventName($event);
    echo "Event $event $id".PHP_EOL;
});

//Resque::push(HelloWorld::class, []);
Resque::later(3, HelloWorld::class, []);

sleep(10);

Result

As shown below, only the first 5 events for Job are fired. image

I personally can't think of a reason. Also would be great if someone explained to me how to correctly listen for jobs. For example, I want to post-process jobs, check if they ran correctly and email results along with job output.

PAXANDDOS avatar Jun 06 '23 12:06 PAXANDDOS

Thanks for the issue/bug report @PAXANDDOS! Sorry, I've somehow missed this issue. I'll have a look.

xelan avatar Sep 13 '23 09:09 xelan

Hi! I've closed this because apparently, it does work..? Idk, further testing is needed, but in my project JOB_COMPLETE event worked (I temporarily have a slightly modified copy of the package). However in the script I provided in this issue it didn't work

PAXANDDOS avatar Sep 13 '23 11:09 PAXANDDOS