<?php
// CLI/cron worker: php admin/cron/subscribers_queue_worker.php
@ini_set('display_errors','1'); @ini_set('max_execution_time','0'); @set_time_limit(0);
require_once __DIR__ . '/../db_bootstrap.php';
require_once __DIR__ . '/../subscribers_queue_lib.php';
$conn=ensure_db(true);
$maxJobs = isset($argv[1]) ? max(1,(int)$argv[1]) : 3;
$maxSeconds = isset($argv[2]) ? max(10,(int)$argv[2]) : 55;
$res=sq_run_worker($conn,$maxJobs,$maxSeconds);
echo json_encode($res,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES).PHP_EOL;
