Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue processing issue #3

Open
code2prog opened this issue Feb 12, 2018 · 4 comments
Open

Queue processing issue #3

code2prog opened this issue Feb 12, 2018 · 4 comments

Comments

@code2prog
Copy link

code2prog commented Feb 12, 2018

I have a problem with this library. Jobs are added to the database but are not performed. Single event is created with name wp_queue_connections_databaseconnection and after few moments it disappears from Event list.
My code:

$items = [
        'test 1',
        'test 2',
        'test 3',
        'test 4',
    ];

    foreach ($items as $item) {
        wp_queue()->push(new \Some_Class\Backup_Job($item));
    }

    wp_queue()->cron();

Job class:

namespace Some_Class;


use WP_Queue\Job;

class Backup_Job extends Job
{
    public $name;

    /**
     * Backup_Job constructor.
     * @param $name
     */
    public function __construct($name)
    {
        $this->name = $name;
    }

    public function handle()
    {
        sleep(1);
    }

}

Jobs in DB:
2018-02-12_21-07-53

Jobs are not fail. Just stuck in wp_queue_jobs

@code2prog
Copy link
Author

Ping :)

@martijn94
Copy link

Do your jobs get processed when u manually call the worker?

This way you know if it's a problem with WP_Cron or the actual queue.

wp_queue()->worker()->process()

@rorymcdaniel
Copy link

I'm having the exact same issue, even when I manually call wp_queue()->worker()->process()

@rorymcdaniel
Copy link

I should add that it appears my issue was caused by problems in a script called by my Job class. Once I resolved this issue, manually calling the worker appears to have worked. That being said, I feel like this is when it should have been marked as a failed job.

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

No branches or pull requests

3 participants