wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

EnqueueIn doesn't seem to be working #105

Open rui902 opened 7 years ago

rui902 commented 7 years ago

Hi, I've been testing CakeResque for a week now, and all seemed very fine, but since yesterday that i've been struggling to add a delayed task.

I only have one scheduler worker and one regular worker running, only the default queue, and it seems that all jobs get processed without failing, but nothing seems to happen.

I have tried the exact same code with just enqueue and it works, when i change to enqueueIn it doesn't work...

Let me know if I'm doing anything wrong; below is the code and outputs of cakeresque

Stats: Resque Statistics

Jobs Stats Processed Jobs : 430 Failed Jobs : 0 Scheduled Jobs : 0

Queues Stats Queues count : 1

Workers Stats Workers count : 2 REGULAR WORKERS

PHP: // with enqueueIn; not working CakeResque::enqueueIn( 5, 'default', 'BackgroundShell', array('test', $data) );

// with enqueue; working CakeResque::enqueue( 'default', 'BackgroundShell', array('test', $data) );

kthiha-dev commented 5 years ago

Did you got any solution for this? I also got the same issue. We did use this service for quite long ago and no issue at all. But, suddenly my local environment have this issue.

SCHEDULER WORKER
   - Started on     : Thu Sep 12 17:58:01 SGT 2019
   - Delayed Jobs   : 1
   - Next Job on    : Thu Jan 01 07:30:00 SGT 1970

I have no idea what I'm dealing with. @rui902 did you got any solution for this ?

kthiha-dev commented 5 years ago

If anyone facing this problem, please use enqueueAt instead of enqueueIn.

CakeResque::enqueueAt(
    new DateTime('2019-12-01 15:56:23'),
    'default',      // Queue Name
    'FriendShell', // Job classname
    array('findNewFriends', 'John Doe', 'Ghana') // Various args
);

or If you want to tigger in next 20 minutes,

$scheduleTime = strtotime("+20 minutes");
CakeResque::enqueueAt(
    new DateTime(date('Y-m-d H:i:s',$scheduleTime)),
    'default',      // Queue Name
    'FriendShell', // Job classname
    array('findNewFriends', 'John Doe', 'Ghana') // Various args
);

Hope this help to others.

kthiha-dev commented 4 years ago

Just got a update for this. When I flushdb in redis-cli, all queue job stuck in

Thu Jan 01 07:30:00 SGT 1970 (I used Singapore Timezone)

I hope, this can help someone too.