Skip to content

Commit ba396be

Browse files
authored
Merge pull request #704 from cakephp/requests-gc
Use sub query instead of ids array.
2 parents 2ebc6b6 + cde493f commit ba396be

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Model/Table/RequestsTable.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ public function findRecent(Query $query, array $options)
7979
/**
8080
* Garbage collect old request data.
8181
*
82-
* Delete request data that is older than 2 weeks old.
82+
* Delete request data that is older than latest 20 requests.
83+
* You can use the `DebugKit.requestCount` config to change this limit.
8384
* This method will only trigger periodically.
8485
*
8586
* @return void
@@ -91,11 +92,8 @@ public function gc()
9192
}
9293
$noPurge = $this->find()
9394
->select(['id'])
94-
->enableHydration(false)
9595
->order(['requested_at' => 'desc'])
96-
->limit(Configure::read('DebugKit.requestCount') ?: 20)
97-
->extract('id')
98-
->toArray();
96+
->limit(Configure::read('DebugKit.requestCount') ?: 20);
9997

10098
$query = $this->Panels->query()
10199
->delete()

0 commit comments

Comments
 (0)