php-resque
php-resque copied to clipboard
Several events are not working
The issue for Resque v4 in PR #117 but probably exists in previous versions of v4 and v3
Issue
Selected events are not working:
To reproduce
- Use the v4 branch (if #117 is merged)
- Uncomment the
redis
block inresque.yml
, changehost
toredis
andphpiredis
totrue
- Run
docker compose up -d
- (terminal 1) Run
docker exec resque bin/resque worker:start
- Create example file
a.php
and fill it with contents (see below) - (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.
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.
Thanks for the issue/bug report @PAXANDDOS! Sorry, I've somehow missed this issue. I'll have a look.
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