mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-21 02:07:23 -04:00
Introduce a lightweight job scheduling system built on CI4 Tasks,
allowing due tasks to run via normal web traffic instead of relying
solely on external cron/Task Scheduler processes.
- Add JobRunner filter: runs TaskRunner after response send via
shutdown function, throttled per-minute via cache, respects
jobs_mode config ('auto'/'web'/'manual') and max-seconds budget
- Register jobrunner filter globally (app/Config/Filters.php),
disabled during testing to avoid heartbeat log spam
- Add Config/Tasks.php with jobs_heartbeat scheduled task (debug
log every minute) as scaffolding for future job commands
- Add Config/Jobs.php for mode/webMaxSeconds defaults
- Add Jobs controller + views (manage, settings_config,
utilities_config, partial/job_throttles) for configuring mode,
web max seconds, and per-period throttles; process-all/selected
actions stubbed for a later phase
- Add gulp task to copy jobs.svg menubar icon
- Fix tooltip clipping: use container: 'body' for bootstrap
tooltips and add max-width/text-align rules for tooltip-inner /
ui-tooltip in ospos.css
- Fix missing closing div in partial/footer.php layout
Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
56 lines
1.8 KiB
PHP
56 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* This file is part of CodeIgniter Tasks.
|
|
*
|
|
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Config;
|
|
|
|
use CodeIgniter\Tasks\Config\Tasks as BaseTasks;
|
|
use CodeIgniter\Tasks\Scheduler;
|
|
|
|
class Tasks extends BaseTasks
|
|
{
|
|
/**
|
|
* --------------------------------------------------------------------------
|
|
* Should performance metrics be logged
|
|
* --------------------------------------------------------------------------
|
|
*
|
|
* If true, will log the time it takes for each task to run.
|
|
* Requires the settings table to have been created previously.
|
|
*/
|
|
public bool $logPerformance = false;
|
|
|
|
/**
|
|
* --------------------------------------------------------------------------
|
|
* Maximum performance logs
|
|
* --------------------------------------------------------------------------
|
|
*
|
|
* The maximum number of logs that should be saved per Task.
|
|
* Lower numbers reduced the amount of database required to
|
|
* store the logs.
|
|
*/
|
|
public int $maxLogsPerTask = 10;
|
|
|
|
/**
|
|
* Register any tasks within this method for the application.
|
|
* Called by the TaskRunner.
|
|
*/
|
|
public function init(Scheduler $schedule)
|
|
{
|
|
// Heartbeat task: mode-agnostic, just logs whenever `tasks:run` executes it -
|
|
// whether triggered by cron/Task Scheduler (auto), a manual `spark tasks:run` (manual),
|
|
// or the JobRunner filter (web). Replace once real job-processing commands exist.
|
|
$schedule->call(static function () {
|
|
log_message('debug', 'Job Queue heartbeat: tasks:run executed at ' . date('c'));
|
|
})->everyMinute()->named('jobs_heartbeat');
|
|
}
|
|
}
|