| | |
| | | private Storage $storage; |
| | | private Processor $processor; |
| | | private TypeRegistry $registry; |
| | | public Executor $executor; |
| | | private Locker $locker; |
| | | |
| | | public function __construct() |
| | |
| | | $this->registry = new TypeRegistry(); |
| | | $this->locker = new Locker(); |
| | | |
| | | $executor = new FilteredExecutor($this->storage); |
| | | $this->processor = new Processor($this->storage, $executor, $this->registry); |
| | | $this->executor = new FilteredExecutor(); |
| | | $this->processor = new Processor($this->storage, $this->executor, $this->registry); |
| | | |
| | | add_action('jvb_process_queue', [$this, 'checkQueue']); |
| | | add_action('jvb_queue_maintenance', [$this, 'maintenance']); |
| | |
| | | public function maintenance(): void |
| | | { |
| | | $this->locker->withLock(function () { |
| | | $this->cleanupStuck(); |
| | | $this->storage->resetStuckOperations(30); |
| | | }); |
| | | |
| | | } |
| | | |
| | | private function cleanupStuck(): void |
| | | { |
| | | $this->storage->resetStuckOperations(30); |
| | | } |
| | | |
| | | // === Public Getters === |
| | | |
| | | public function get(string $id): ?Operation |