Skip to content

Commit

Permalink
Remove unused listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioheleno committed Mar 16, 2022
1 parent f6edbd1 commit 45ff74d
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 113 deletions.
17 changes: 4 additions & 13 deletions app/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,26 @@
use App\Application\Message\Command\PackageDiscoveryCommand;
use App\Application\Message\Command\UpdateDependencyStatusCommand;
use App\Application\Message\Command\UpdateVersionStatusCommand;
use App\Application\Message\Event\Dependency\DependencyCreatedEvent;
use App\Application\Message\Event\Dependency\DependencyUpdatedEvent;
use App\Application\Message\Event\Package\PackageCreatedEvent;
use App\Application\Message\Event\Package\PackageUpdatedEvent;
use App\Application\Message\Event\Version\VersionCreatedEvent;
use App\Application\Message\Event\Version\VersionUpdatedEvent;
use App\Application\Processor\Handler\PackageDiscoveryHandler;
use App\Application\Processor\Handler\UpdateDependencyStatusHandler;
use App\Application\Processor\Handler\UpdateVersionStatusHandler;
use App\Application\Processor\Listener\Dependency\DependencyCreatedListener;
use App\Application\Processor\Listener\Dependency\DependencyUpdatedListener;
use App\Application\Processor\Listener\Package\PackageCreatedListener;
use App\Application\Processor\Listener\Package\PackageUpdatedListener;
use App\Application\Processor\Listener\Version\VersionCreatedListener;
use App\Application\Processor\Listener\Version\VersionUpdatedListener;
use Courier\Bus;
use Psr\Container\ContainerInterface;

return static function (ContainerInterface $container): void {
$router = $container->get(Bus::class)->getRouter();
$bus = $container->get(Bus::class);
$router = $bus->getRouter();

/* DEPENDENCY EVENTS */
$router
->addRoute(
DependencyCreatedEvent::class,
DependencyCreatedListener::class
)
->addRoute(
DependencyUpdatedEvent::class,
DependencyUpdatedListener::class
Expand All @@ -52,10 +45,6 @@
->addRoute(
VersionCreatedEvent::class,
VersionCreatedListener::class
)
->addRoute(
VersionUpdatedEvent::class,
VersionUpdatedListener::class
);

/* PACKAGE COMMANDS */
Expand All @@ -75,4 +64,6 @@
UpdateVersionStatusCommand::class,
UpdateVersionStatusHandler::class
);

$bus->bindRoutes();
};
4 changes: 0 additions & 4 deletions app/processors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
use App\Application\Processor\Handler\PackageDiscoveryHandler;
use App\Application\Processor\Handler\UpdateDependencyStatusHandler;
use App\Application\Processor\Handler\UpdateVersionStatusHandler;
use App\Application\Processor\Listener\Dependency\DependencyCreatedListener;
use App\Application\Processor\Listener\Dependency\DependencyUpdatedListener;
use App\Application\Processor\Listener\Package\PackageCreatedListener;
use App\Application\Processor\Listener\Package\PackageUpdatedListener;
use App\Application\Processor\Listener\Version\VersionCreatedListener;
use App\Application\Processor\Listener\Version\VersionUpdatedListener;
use DI\ContainerBuilder;
use function DI\autowire;

Expand All @@ -26,12 +24,10 @@
/* LISTENERS */
$containerBuilder->addDefinitions(
[
DependencyCreatedListener::class => autowire(DependencyCreatedListener::class),
DependencyUpdatedListener::class => autowire(DependencyUpdatedListener::class),
PackageCreatedListener::class => autowire(PackageCreatedListener::class),
PackageUpdatedListener::class => autowire(PackageUpdatedListener::class),
VersionCreatedListener::class => autowire(VersionCreatedListener::class),
VersionUpdatedListener::class => autowire(VersionUpdatedListener::class)
]
);
};
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
},
"require-dev": {
"infection/infection": "^0.26",
"php-parallel-lint/php-parallel-lint": "^1.2",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"psy/psysh": "^0.11",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.3"
"squizlabs/php_codesniffer": "^3.6",
"vimeo/psalm": "^4.8"
},
"scripts": {
"console": "vendor/bin/psysh",
Expand Down
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/Application/Console/Packagist/GetDataCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$json = json_decode(file_get_contents($dataPath), true, 512, JSON_THROW_ON_ERROR);

$this->producer->setupBroker();

$package = $this->packageRepository->get($packageName);
$package = $package
->withDescription($json['package']['description'] ?? '')
Expand Down
2 changes: 0 additions & 2 deletions src/Application/Console/Packagist/GetListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ static function (Package $package): string {
)
);

$this->producer->setupBroker();

foreach ($addList as $packageName) {
$package = $this->packageRepository->create($packageName);

Expand Down
2 changes: 0 additions & 2 deletions src/Application/Console/Queue/QueueConsumerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

$this->consumer->setupBroker();

while (true) {
$this->consumer->consume();
usleep(200000);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct(Producer $producer, LoggerInterface $logger) {
*/
public function __invoke(EventInterface $event): void {
$dependency = $event->getDependency();
$this->logger->debug('Dependency updated', [$dependency]);
// $this->logger->debug('Dependency updated', [$dependency]);

$this->producer->sendCommand(
new UpdateVersionStatusCommand($dependency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(Producer $producer, LoggerInterface $logger) {

public function __invoke(EventInterface $event): void {
$package = $event->getPackage();
$this->logger->debug('Package created', [$package]);
// $this->logger->debug('Package created', [$package]);

$this->producer->sendCommand(
new PackageDiscoveryCommand($package)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct(Producer $producer, LoggerInterface $logger) {

public function __invoke(EventInterface $event): void {
$package = $event->getPackage();
$this->logger->debug('Package updated', [$package]);
// $this->logger->debug('Package updated', [$package]);

if ($package->getLatestVersion() === '') {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
*/
public function __invoke(EventInterface $event): void {
$version = $event->getVersion();
$this->logger->debug('Version created', [$version]);
// $this->logger->debug('Version created', [$version]);

// ignore non-release versions
if ($version->isRelease() === false) {
Expand Down

This file was deleted.

0 comments on commit 45ff74d

Please sign in to comment.