mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-09-20 09:47:57 -04:00
refactor(filters): use BoundedTaskRunner in JobRunner
- Replace TaskRunner with BoundedTaskRunner, passing deadline (start + maxSeconds) so scheduled task execution respects the filter's time budget instead of running unbounded. - Remove now-unused TaskRunner import; runner is instantiated only when time remains before maxSeconds. Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
This commit is contained in:
1 parent
ff843af4ec
commit
71bd0d2eed
1 file changed
+1
-3
@@ -5,7 +5,6 @@ namespace App\Filters;
|
||||
use CodeIgniter\Filters\FilterInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Tasks\TaskRunner;
|
||||
use Config\OSPOS;
|
||||
use Config\Tasks;
|
||||
use Throwable;
|
||||
@@ -55,9 +54,8 @@ class JobRunner implements FilterInterface
|
||||
try {
|
||||
config(Tasks::class)->init(service('scheduler'));
|
||||
|
||||
$runner = new TaskRunner();
|
||||
|
||||
if (microtime(true) - $start < $maxSeconds) {
|
||||
$runner = new BoundedTaskRunner($start + $maxSeconds);
|
||||
$runner->run();
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
|
||||
Reference in new issue
Block a user