Git Product home page Git Product logo

sansdaemon's Introduction

SansDaemon

Build Status Latest Stable Version Total Downloads License

Introduction

Batch process Laravel Queue without a daemon; Processes all jobs on the queue(s) and exits without running on daemon mode. This is useful in cases where you just want to process jobs on the queue and exit the worker process so they don't pile up in memory.

Installation

To install the latest version of SansDaemon, simply use composer

Download

composer require queueworker/sansdaemon
  • If your Laravel version is below 5.5, you'll need to add the service provider to your config/app.php file.
Queueworker\SansDaemon\SansDaemonServiceProvider::class,

Usage

SansDaemon is a console application that extends the functionality of laravel's WorkCommand - Illuminate\Queue\Console\WorkCommand. See Laravel Queue documentation.

To run the queue worker sans-daemon mode, simply add the --sansdaemon option to the original laravel queue worker command:

php artisan queue:work --sansdaemon

Argument and Options

Since this package extends laravel's WorkCommand, it takes exactly all the arguments and options the original WorkCommand takes with three added options:

  • --sansdaemon option tell the worker to process jobs on the queue without running in daemon mode.
  • --jobs (default: 0, optional) - It allows you to specify the number of jobs to process each time the command runs. The default value 0 means it'll process all available jobs in the queue.
  • --max_exec_time (default: ini_get('max_execution_time') - 5s, optional) - On some webhosts, your scripts will be killed, if it exceeds some amount of time. To prevent this behavior on really full queue, worker will stop after --max_exec_time. This is especially useful if you're running this command via your application's route or controller. See Laravel Documentation on how to run your queue programmatically.

Note on --max_exec_time

  • 0 (zero) means the worker will run forever, which in this context means until the worker process is done. This is the default behavior when run from CLI.
  • This option will not prevent Maximum execution time exceeded error, it'll try to avoid it by not running the next job on the queue if the script is reaching its max_execution_time

Testing

composer test

License

MIT license (MIT) - Check out the License File for more.

sansdaemon's People

Contributors

orobogenius avatar arxeiss 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.