Skip to content

Instantly share code, notes, and snippets.

@petarBozovic
Last active August 22, 2023 17:23
Show Gist options
  • Save petarBozovic/90a248136ba3775a5e0c62832a59e402 to your computer and use it in GitHub Desktop.
Save petarBozovic/90a248136ba3775a5e0c62832a59e402 to your computer and use it in GitHub Desktop.
<?php
/* Magento 2.4.3
* "Consumer with the same name is running"
* If this message Displays after all processes have been killed...
* This script unlock the consumer to allow run when there was an issue or a process was killed.
*/
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/unlockRabbitMQAsyncOp.log');
$logger = new \Zend_Log();
$logger->addWriter($writer);
try {
$lockManager = $obj->create('Magento\Framework\Lock\LockManagerInterface');
$lockManager->unlock('async.operations.all');
echo 'Done' . PHP_EOL;
} catch (\Exception $e) {
echo print_r($e->getMessage(), true);
$logger->info("{$e->getMessage()}:{$e->getTraceAsString()}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment