Skip to content

Commit db4e52f

Browse files
committed
Replace deprecated React\EventLoop\Factory::create()
Replace with `React\EventLoop\Loop::get()`. The single instance guard around the deprecated function call can be avoided now, because this is already done inside the new function.
1 parent 8fc9b01 commit db4e52f

4 files changed

Lines changed: 6 additions & 19 deletions

File tree

application/clicommands/Command.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Icinga\Cli\Command as CliCommand;
1515
use Icinga\Module\Vspheredb\Configuration;
1616
use Icinga\Module\Vspheredb\Daemon\RemoteClient;
17-
use React\EventLoop\Factory as Loop;
17+
use React\EventLoop\Loop;
1818
use React\EventLoop\LoopInterface;
1919
use React\Stream\WritableResourceStream;
2020

@@ -39,11 +39,7 @@ public function init()
3939

4040
protected function loop()
4141
{
42-
if ($this->loop === null) {
43-
$this->loop = Loop::create();
44-
}
45-
46-
return $this->loop;
42+
return Loop::get();
4743
}
4844

4945
protected function eventuallyStartMainLoop()

application/controllers/AsyncControllerHelper.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44

55
use Icinga\Module\Vspheredb\Configuration;
66
use Icinga\Module\Vspheredb\Daemon\RemoteClient;
7-
use React\EventLoop\Factory as Loop;
7+
use React\EventLoop\Loop;
88

99
use function React\Async\await;
1010
use function React\Promise\Timer\timeout;
1111

1212
trait AsyncControllerHelper
1313
{
14-
protected $loop;
15-
1614
/** @var RemoteClient */
1715
protected $remoteClient;
1816

@@ -35,11 +33,6 @@ protected function remoteClient()
3533

3634
protected function loop()
3735
{
38-
// Hint: we're not running this loop right now
39-
if ($this->loop === null) {
40-
$this->loop = Loop::create();
41-
}
42-
43-
return $this->loop;
36+
return Loop::get();
4437
}
4538
}

library/Vspheredb/Web/Form/ChooseInfluxDatabaseForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function createDatabase($name)
9191
$promise = $this->client->request('influxdb.createDatabase', $this->prepareParams() + [
9292
'dbName' => $name
9393
]);
94-
$result = await($promise, $this->loop);
94+
$result = await($promise);
9595
Notification::info("DON $name");
9696

9797
return $result;

library/Vspheredb/Web/Form/LogLevelForm.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ protected function assemble()
6363

6464
protected function onSuccess()
6565
{
66-
await($this->client->request('logger.setLogLevel', [
67-
'level' => $this->getValue('log_level')
68-
]), $this->loop);
66+
await($this->client->request('logger.setLogLevel', ['level' => $this->getValue('log_level')]));
6967
}
7068

7169
protected function listLogLevels()

0 commit comments

Comments
 (0)