We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91bd73b commit a9d36c6Copy full SHA for a9d36c6
README.md
@@ -128,12 +128,12 @@ return [
128
'rabbitmq' => [
129
// ...
130
'on before_consume' => function ($event) {
131
- if (isset(\Yii::$app->db)) {
132
- $db = \Yii::$app->db;
133
- if ($db->getIsActive()) {
134
- $db->close();
+ if (isset(\Yii::$app->db) && \Yii::$app->db->isActive) {
+ try {
+ Yii::$app->db->createCommand('SELECT 1')->query();
+ } catch (\yii\db\Exception $exception) {
135
+ Yii::$app->db->close();
136
}
- $db->open();
137
138
},
139
],
0 commit comments