With one of our front-end forms to create an entry, suddenly we receive this error after many months of it working fine: yii\base\Exception: Has not waited the lock
yii\base\Exception: Has not waited the lock. in /home/ben/craft/vendor/craftcms/cms/src/queue/Queue.php:562
Stack trace:
#0 /home/ben/craft/vendor/craftcms/cms/src/queue/Queue.php(120): craft\queue\Queue->reserve()
#1 /home/ben/craft/modules/craft-businesslogic/src/BusinessLogic.php(239): craft\queue\Queue->run()
#2 [internal function]: modules\businesslogic\BusinessLogic->modules\businesslogic\{closure}(Object(craft\events\ModelEvent))
#3 /home/ben/craft/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Object(Closure), Object(craft\events\ModelEvent))
#4 /home/ben/craft/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('craft\\elements\\...', 'afterSave', Object(craft\events\ModelEvent))
#5 /home/ben/craft/vendor/craftcms/cms/src/base/Element.php(2565): yii\base\Component->trigger('afterSave', Object(craft\events\ModelEvent))
#6 /home/ben/craft/vendor/craftcms/cms/src/elements/Entry.php(1301): craft\base\Element->afterSave(true)
#7 /home/ben/craft/vendor/craftcms/cms/src/services/Elements.php(2169): craft\elements\Entry->afterSave(true)
#8 /home/ben/craft/vendor/craftcms/cms/src/services/Elements.php(531): craft\services\Elements->_saveElementInternal(Object(craft\elements\Entry), true, false, true)
#9 /home/ben/craft/vendor/craftcms/cms/src/controllers/EntriesController.php(376): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#10 [internal function]: craft\controllers\EntriesController->actionSaveEntry(false)
#11 /home/ben/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /home/ben/craft/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /home/ben/craft/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction('save-entry', Array)
#14 /home/ben/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry', Array)
#15 /home/ben/craft/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction('entries/save-en...', Array)
#16 /home/ben/craft/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction('entries/save-en...', Array)
#17 /home/ben/craft/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#18 /home/ben/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /home/ben/public_html/index.php(21): yii\base\Application->run()
#20 {main}
What鈥檚 happening around /home/ben/craft/modules/craft-businesslogic/src/BusinessLogic.php line 239?
@brandonkelly We are adding a Campaign sendout to the queue: Craft::$app->getQueue()->run(); - it is preceded by Campaign::$plugin->sendouts->queuePendingSendouts();
Interestingly, I cleared cache and this seemed to resolve it... for now. But any insight would be welcomed, thanks.
Yeah ok, you should not be calling run() yourself there. Just add jobs to the queue via push() and let the normal queue runner take care of it.
Most helpful comment
Yeah ok, you should not be calling
run()yourself there. Just add jobs to the queue viapush()and let the normal queue runner take care of it.