mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Merge pull request #13160 from appwrite/skip-projects-subqueries-scheduler
skip projects subqueries in shceduler
This commit is contained in:
1 file changed
+13
-4
@@ -237,10 +237,19 @@ abstract class ScheduleBase extends Action
|
||||
|
||||
foreach ($batches as $batch) {
|
||||
$dbStart = microtime(true);
|
||||
$documents = $dbForPlatform->find('projects', [
|
||||
Query::equal('$id', $batch),
|
||||
Query::limit(count($batch)),
|
||||
]);
|
||||
// The project's subquery attributes cost one query each, per project — five
|
||||
// thousand extra queries for a batch of a thousand projects — and no
|
||||
// schedule task reads them. The only attributes used here are accessedAt,
|
||||
// teamId, database and the sequence, and the documents enqueued for the
|
||||
// workers are reloaded there by id, so the stripped arrays never reach the
|
||||
// code that needs them. Same group Action::$filters marks as Project.
|
||||
$documents = $dbForPlatform->skipFilters(
|
||||
fn () => $dbForPlatform->find('projects', [
|
||||
Query::equal('$id', $batch),
|
||||
Query::limit(count($batch)),
|
||||
]),
|
||||
['subQueryKeys', 'subQueryWebhooks', 'subQueryPlatforms', 'subQueryBlocks', 'subQueryDevKeys']
|
||||
);
|
||||
$dbQueryDuration += microtime(true) - $dbStart;
|
||||
|
||||
$transformStart = microtime(true);
|
||||
|
||||
Reference in new issue
Block a user