diff --git a/src/Controller/Admin/QueueController.php b/src/Controller/Admin/QueueController.php index 350c9e18..2a4f0d37 100644 --- a/src/Controller/Admin/QueueController.php +++ b/src/Controller/Admin/QueueController.php @@ -58,7 +58,11 @@ public function index() { $tasks = $taskFinder->all(); $addableTasks = $taskFinder->allAddable(AddFromBackendInterface::class); - $servers = $this->QueueProcesses->find()->distinct(['server'])->find('list', ['keyField' => 'server', 'valueField' => 'server'])->toArray(); + $servers = $this->QueueProcesses->find() + ->distinct(['server']) + ->where(['server IS NOT' => null]) + ->find('list', ['keyField' => 'server', 'valueField' => 'server']) + ->toArray(); $this->set(compact('new', 'current', 'data', 'pendingDetails', 'status', 'tasks', 'addableTasks', 'servers')); } diff --git a/src/Queue/Processor.php b/src/Queue/Processor.php index e3779f74..48be2424 100644 --- a/src/Queue/Processor.php +++ b/src/Queue/Processor.php @@ -24,6 +24,7 @@ /** * Main shell to init and run queue workers. */ +#[\AllowDynamicProperties] class Processor { /* diff --git a/tests/TestCase/Model/Table/QueuedJobsTableTest.php b/tests/TestCase/Model/Table/QueuedJobsTableTest.php index ea961381..e2d988cc 100644 --- a/tests/TestCase/Model/Table/QueuedJobsTableTest.php +++ b/tests/TestCase/Model/Table/QueuedJobsTableTest.php @@ -352,7 +352,8 @@ public function testNotBeforeOrder() { $tmp = $this->QueuedJobs->requestJob($capabilities); $this->assertSame($item['name'], $tmp['job_task']); - $this->assertEquals($item['data'], unserialize($tmp['data'])); + $dataValue = $tmp['data'] !== null ? unserialize($tmp['data']) : null; + $this->assertEquals($item['data'], $dataValue); } } @@ -415,14 +416,14 @@ public function testRateLimit() { $this->QueuedJobs->clearKey(); $tmp = $this->QueuedJobs->requestJob($capabilities); $this->assertSame('Queue.Example', $tmp['job_task']); - $this->assertFalse(unserialize($tmp['data'])); + $this->assertNull($tmp['data']); usleep(100000); //and again. $this->QueuedJobs->clearKey(); $tmp = $this->QueuedJobs->requestJob($capabilities); $this->assertSame('Queue.Example', $tmp['job_task']); - $this->assertFalse(unserialize($tmp['data'])); + $this->assertNull($tmp['data']); //Then some time passes sleep(2); @@ -437,7 +438,7 @@ public function testRateLimit() { $this->QueuedJobs->clearKey(); $tmp = $this->QueuedJobs->requestJob($capabilities); $this->assertSame('Queue.Example', $tmp['job_task']); - $this->assertFalse(unserialize($tmp['data'])); + $this->assertNull($tmp['data']); //Then some more time passes sleep(2); @@ -452,7 +453,7 @@ public function testRateLimit() { $this->QueuedJobs->clearKey(); $tmp = $this->QueuedJobs->requestJob($capabilities); $this->assertSame('Queue.Example', $tmp['job_task']); - $this->assertFalse(unserialize($tmp['data'])); + $this->assertNull($tmp['data']); //and now the queue is empty $this->QueuedJobs->clearKey();