You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
578 B

  1. <?php
  2. declare(ticks=1);
  3. chdir('..');
  4. $mode = 'run';
  5. if(array_key_exists(1, $argv) && $argv[1] == 'once')
  6. $mode = 'once';
  7. if($mode == 'run') {
  8. if(function_exists('pcntl_signal')) {
  9. pcntl_signal(SIGINT, function($sig){
  10. global $pcntl_continue;
  11. $pcntl_continue = FALSE;
  12. });
  13. }
  14. }
  15. $pcntl_continue = TRUE;
  16. define('PDO_SUPPORT_DELAYED', TRUE);
  17. // TODO: add support for forking and running many workers in parallel
  18. // e.g. `php run.php 10`
  19. require 'vendor/autoload.php';
  20. if($mode == 'once') {
  21. DeferredTask::run_once();
  22. } else {
  23. DeferredTask::run();
  24. }