Skip to content

Commit

Permalink
Fixed discovery timer (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 29, 2024
1 parent ab866bf commit d9f6f06
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Commands/Discover.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace FastyBird\Connector\Viera\Commands;

use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\DBAL;
use FastyBird\Connector\Viera;
Expand Down Expand Up @@ -132,6 +133,10 @@ protected function execute(Input\InputInterface $input, Output\OutputInterface $
return Console\Command\Command::FAILURE;
}

$executedTime = $this->clock->getNow();
assert($executedTime instanceof DateTimeImmutable);
$this->executedTime = $executedTime->modify('-5 second');

$io = new Style\SymfonyStyle($input, $output);

$io->title((string) $this->translator->translate('//viera-connector.cmd.discover.title'));
Expand Down Expand Up @@ -304,8 +309,6 @@ function (string|int|null $answer) use ($connectors): Documents\Connectors\Conne

$io->info((string) $this->translator->translate('//viera-connector.cmd.discover.messages.starting'));

$this->executedTime = $this->clock->getNow();

$serviceCmd = $symfonyApp->find(DevicesCommands\Connector::NAME);

$result = $serviceCmd->run(new Input\ArrayInput([
Expand Down
3 changes: 3 additions & 0 deletions src/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace FastyBird\Connector\Viera\Commands;

use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\DBAL;
use FastyBird\Connector\Viera;
Expand Down Expand Up @@ -1713,6 +1714,8 @@ private function discoverDevices(Style\SymfonyStyle $io, Entities\Connectors\Con
}

$executedTime = $this->clock->getNow();
assert($executedTime instanceof DateTimeImmutable);
$executedTime = $executedTime->modify('-5 second');

$symfonyApp = $this->getApplication();

Expand Down

0 comments on commit d9f6f06

Please sign in to comment.