File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
app/code/Magento/MysqlMq/Model/ResourceModel Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ public function getMessages($queueName, $limit = null)
163
163
}
164
164
165
165
/**
166
- * Delete messages if there is no queue whrere the message is not in status TO BE DELETED
166
+ * Delete messages if there is no queue where the message is not in status TO BE DELETED
167
167
*
168
168
* @return void
169
169
*/
@@ -177,8 +177,15 @@ public function deleteMarkedMessages()
177
177
->distinct ();
178
178
$ messageIds = $ connection ->fetchCol ($ select );
179
179
180
- $ condition = count ($ messageIds ) > 0 ? ['id NOT IN (?) ' => $ messageIds ] : null ;
181
- $ connection ->delete ($ this ->getMessageTable (), $ condition );
180
+ if ($ messageIds ) {
181
+ $ condition = count ($ messageIds ) > 0 ? ['id NOT IN (?) ' => $ messageIds ] : null ;
182
+ $ connection ->delete ($ this ->getMessageTable (), $ condition );
183
+ } else {
184
+ $ select = $ connection ->select ()
185
+ ->from (['queue_message_status ' => $ this ->getMessageStatusTable ()], ['message_id ' ])
186
+ ->where ('status = ? ' , QueueManagement::MESSAGE_STATUS_TO_BE_DELETED );
187
+ $ connection ->delete ($ this ->getMessageTable (), 'id IN ( ' . $ select ->assemble () . ') ' );
188
+ }
182
189
}
183
190
184
191
/**
You can’t perform that action at this time.
0 commit comments