Coder Social home page Coder Social logo

parallel-processing's Introduction

Laravel Parallel Processing

An easy way to run multiple commands in parallel in laravel.

Install

Install via composer

composer require akbansa/parallel-processor

Usage

Import Akbansa\LaravelParallelProcessor\ParallelProcessor where you want to use this parallel processor.

$processor = new ParallelProcessor($tasks, $options);
$processor->start();

while (!$processor->isFinished()) {
    sleep(1);
}

$tasks can be an array or collection of tasks that needs to be run and each item of this $tasks should have command as it's one of the property that need to be run.

For example

$tasks = [
    ["id" => 1, "command" => "php artisan send:email [email protected]"],
    ["id" => 2, "command" => "php artisan send:email [email protected]"]
]

$options is an optional parameter in which you can pass parameters in an array as follow:

1. $parallelCount => This can be used to define the number parallel processes to be executed (default: 3)
2. $estimateProcessTime => average estimate time for process in second (default 1)

License

The MIT License. Please see the License File

parallel-processing's People

Contributors

akbansa avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.