File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
app/code/Magento/Persistent Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function execute(int $websiteId): void
61
61
private function processStoreQuotes (StoreInterface $ store ): void
62
62
{
63
63
$ batchSize = 500 ;
64
- $ lastProcessedId = 0 ;
64
+ $ lastProcessedId = $ count = 0 ;
65
65
66
66
while (true ) {
67
67
$ quotesToProcess = $ this ->expiredPersistentQuotesCollection
@@ -72,6 +72,7 @@ private function processStoreQuotes(StoreInterface $store): void
72
72
}
73
73
74
74
foreach ($ quotesToProcess as $ quote ) {
75
+ $ count ++;
75
76
try {
76
77
$ this ->quoteRepository ->delete ($ quote );
77
78
$ lastProcessedId = (int )$ quote ->getId ();
@@ -82,12 +83,14 @@ private function processStoreQuotes(StoreInterface $store): void
82
83
(string )$ e
83
84
));
84
85
}
86
+ if ($ count % $ batchSize === 0 ) {
87
+ $ this ->snapshot ->clear ($ quote );
88
+ }
85
89
$ quote ->clearInstance ();
86
90
unset($ quote );
87
91
}
88
92
89
93
$ quotesToProcess ->clear ();
90
- $ this ->snapshot ->clear ();
91
94
unset($ quotesToProcess );
92
95
}
93
96
}
Original file line number Diff line number Diff line change 16
16
use Magento \Store \Model \StoreManagerInterface ;
17
17
use Magento \Quote \Model \ResourceModel \Quote \Collection ;
18
18
use PHPUnit \Framework \MockObject \Exception ;
19
+ use PHPUnit \Framework \MockObject \MockObject ;
19
20
use PHPUnit \Framework \TestCase ;
20
21
use Psr \Log \LoggerInterface ;
21
22
use Magento \Store \Api \Data \StoreInterface ;
22
23
use Magento \Store \Model \Website ;
23
24
25
+ /**
26
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
27
+ */
24
28
class CleanExpiredPersistentQuotesTest extends TestCase
25
29
{
26
30
/**
@@ -38,6 +42,11 @@ class CleanExpiredPersistentQuotesTest extends TestCase
38
42
*/
39
43
private QuoteRepository $ quoteRepositoryMock ;
40
44
45
+ /**
46
+ * @var MockObject|Snapshot
47
+ */
48
+ private MockObject |Snapshot $ snapshotMock ;
49
+
41
50
/**
42
51
* @var LoggerInterface
43
52
*/
You can’t perform that action at this time.
0 commit comments