pool reclaim
This commit is contained in:
parent
adf3f74ef2
commit
70afd1efed
2 changed files with 12 additions and 29 deletions
38
app/cli.php
38
app/cli.php
|
@ -47,20 +47,11 @@ function getConsoleDB(): Database
|
|||
|
||||
$pools = $register->get('pools'); /** @var \Utopia\Pools\Group $pools */
|
||||
|
||||
try {
|
||||
$dbAdapter = $pools
|
||||
->get('console')
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
} catch (Throwable $error) {
|
||||
$pools->fill();
|
||||
$dbAdapter = $pools
|
||||
->get('console')
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
}
|
||||
$dbAdapter = $pools
|
||||
->get('console')
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
|
||||
$database = new Database($dbAdapter, getCache());
|
||||
|
||||
|
@ -80,20 +71,11 @@ function getProjectDB(Document $project): Database
|
|||
return getConsoleDB();
|
||||
}
|
||||
|
||||
try {
|
||||
$dbAdapter = $pools
|
||||
->get($project->getAttribute('database'))
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
} catch (Throwable $error) {
|
||||
$pools->fill();
|
||||
$dbAdapter = $pools
|
||||
->get($project->getAttribute('database'))
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
}
|
||||
$dbAdapter = $pools
|
||||
->get($project->getAttribute('database'))
|
||||
->pop()
|
||||
->getResource()
|
||||
;
|
||||
|
||||
$database = new Database($dbAdapter, getCache());
|
||||
$database->setNamespace('_' . $project->getInternalId());
|
||||
|
|
|
@ -92,7 +92,7 @@ $cli
|
|||
->task('usage')
|
||||
->param('type', 'timeseries', new WhiteList(['timeseries', 'database']))
|
||||
->desc('Schedules syncing data from influxdb to Appwrite console db')
|
||||
->action(function (string $type) use ($logError) {
|
||||
->action(function (string $type) use ($logError, $register) {
|
||||
Console::title('Usage Aggregation V1');
|
||||
Console::success(APP_NAME . ' usage aggregation process v1 has started');
|
||||
|
||||
|
@ -110,4 +110,5 @@ $cli
|
|||
default:
|
||||
Console::error("Unsupported usage aggregation type");
|
||||
}
|
||||
$register->get('pools')->reclaim();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue