Plugin / Async Background Worker

todiadiyatmo

Description

Description

Async Background Worker, more information please visit this page https://tonjoo.github.io/async-background-worker/

Sample Usage

What is it ?

WordPress background worker plugin that enable WordPress to interact with beanstalkd work queue.

Why we need a worker ?

We can run a very long task in the background, for example we need to import 100.000 row into WordPress databases. Instead of doing the 100.000 import in one job, we can separate the job into many smaller job which is safer.

WP-CLI

Make sure you have WP CLI installed on your system

Support Forum

https://forum.tonjoostudio.com/thread-category/async-background-worker/

Add job to queue

  1. Add new job to new worker queue using add_async_job command

    $job = new stdClass();  
    // the function to run  
    $job->function = 'function_to_execute_on_background';  
    // our user entered data  
    $job->user_data = array('data'=>'some_data');
    add_async_job($job);
    
  2. Implement function

    function function_to_execute_on_background($data) {
        //do something usefull
        echo "Background job executed successfully\n";
    }
    
  3. Run wp background-worker listen

Command

  • wp background-worker
    Run Async Background Worker once.

  • wp background-worker listen
    Run Async Background Worker in loop (contiously), this is what you want for background worker. WordPress framework is restart in each loop.

  • wp background-worker listen-daemon
    Run Async Background Worker in loop (contiously) without restart the WordPress framework. NOTE if you use this mode, any code change will not be reflected. You must restart the Async Background Worker each time you change code. This save memory and speed up thing.

Ratings

0
0 reviews

Rating breakdown

Details Information

Version

1.0

First Released

06 Dec, 2017

Total Downloads

243

Wordpress Version

4.4 or higher

Tested up to:

4.9.12

Require PHP Version:

-

Tags

There is no tag found

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.