File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Test/Unit/Model/ResourceModel Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,9 @@ public function deleteMarkedMessages(): void
173
173
174
174
$ select = $ connection ->select ()
175
175
->from (['queue_message_status ' => $ this ->getMessageStatusTable ()], ['message_id ' ])
176
- ->where ('status = ? ' , QueueManagement::MESSAGE_STATUS_TO_BE_DELETED );
177
- $ connection ->delete ($ this ->getMessageTable (), 'id IN ( ' . $ select ->assemble () . ') ' );
176
+ ->where ('status <> ? ' , QueueManagement::MESSAGE_STATUS_TO_BE_DELETED )
177
+ ->distinct ();
178
+ $ connection ->delete ($ this ->getMessageTable (), 'id NOT IN ( ' . $ select ->assemble () . ') ' );
178
179
}
179
180
180
181
/**
Original file line number Diff line number Diff line change @@ -286,16 +286,17 @@ function ($arg1, $arg2) use ($tableNames) {
286
286
$ select ->expects ($ this ->once ())
287
287
->method ('from ' )->with (['queue_message_status ' => $ tableNames [0 ]], ['message_id ' ])->willReturnSelf ();
288
288
$ select ->expects ($ this ->once ())->method ('where ' )
289
- ->with ('status = ? ' , QueueManagement::MESSAGE_STATUS_TO_BE_DELETED )
289
+ ->with ('status <> ? ' , QueueManagement::MESSAGE_STATUS_TO_BE_DELETED )
290
290
->willReturnSelf ();
291
+ $ select ->expects ($ this ->once ())->method ('distinct ' )->willReturnSelf ();
291
292
$ select ->expects ($ this ->once ())
292
293
->method ('assemble ' )
293
294
->willReturn ('SELECT message_id FROM queue_message_status WHERE status = 7 ' );
294
295
295
296
$ connection ->expects ($ this ->once ())->method ('delete ' )
296
297
->with (
297
298
$ tableNames [1 ],
298
- 'id IN (SELECT message_id FROM queue_message_status WHERE status = 7) '
299
+ 'id NOT IN (SELECT message_id FROM queue_message_status WHERE status = 7) '
299
300
)->willReturn (2 );
300
301
$ this ->queue ->deleteMarkedMessages ();
301
302
}
You can’t perform that action at this time.
0 commit comments