Skip to content

Commit

Permalink
Remove more deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 28, 2023
1 parent 5adb5b7 commit cbe2a39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/Controller/Admin/QueueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
1 change: 1 addition & 0 deletions src/Queue/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
/**
* Main shell to init and run queue workers.
*/
#[\AllowDynamicProperties]
class Processor {

/*
Expand Down
11 changes: 6 additions & 5 deletions tests/TestCase/Model/Table/QueuedJobsTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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();
Expand Down

0 comments on commit cbe2a39

Please sign in to comment.