mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Improve reclaim of pools in schedule
This commit is contained in:
+5
-5
@@ -61,16 +61,16 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForConsole,
|
||||
return $dbForConsole;
|
||||
}
|
||||
|
||||
$dbAdapter = $pools
|
||||
$connection = $pools
|
||||
->get($project->getAttribute('database'))
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
->pop();
|
||||
|
||||
$dbAdapter = $connection->getResource();
|
||||
|
||||
$database = new Database($dbAdapter, $cache);
|
||||
$database->setNamespace('_' . $project->getInternalId());
|
||||
|
||||
return $database;
|
||||
return [ $database, fn() => $connection->claim() ];
|
||||
};
|
||||
|
||||
return $getProjectDB;
|
||||
|
||||
@@ -49,7 +49,10 @@ class Schedule extends Action
|
||||
*/
|
||||
$getSchedule = function (Document $schedule) use ($dbForConsole, $getProjectDB): array {
|
||||
$project = $dbForConsole->getDocument('projects', $schedule->getAttribute('projectId'));
|
||||
$function = $getProjectDB($project)->getDocument('functions', $schedule->getAttribute('resourceId'));
|
||||
|
||||
[ $database, $reclaim ] = $getProjectDB($project);
|
||||
$function = $database->getDocument('functions', $schedule->getAttribute('resourceId'));
|
||||
$reclaim();
|
||||
|
||||
return [
|
||||
'resourceId' => $schedule->getAttribute('resourceId'),
|
||||
|
||||
Reference in New Issue
Block a user