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 7948915 commit 59d5cd0
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\NsPanel\Commands;

use DateTimeImmutable;
use DateTimeInterface;
use FastyBird\Connector\NsPanel\Documents;
use FastyBird\Connector\NsPanel\Exceptions;
Expand Down Expand Up @@ -117,6 +118,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('//ns-panel-connector.cmd.discover.title'));
Expand Down Expand Up @@ -295,8 +300,6 @@ function (string|int|null $answer) use ($connectors): Documents\Connectors\Conne

$io->info((string) $this->translator->translate('//ns-panel-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 @@ -16,6 +16,7 @@
namespace FastyBird\Connector\NsPanel\Commands;

use Brick\Math;
use DateTimeImmutable;
use DateTimeInterface;
use Doctrine\DBAL;
use Exception;
Expand Down Expand Up @@ -1271,6 +1272,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 59d5cd0

Please sign in to comment.