1
0
Fork 0
mirror of synced 2024-06-30 12:10:51 +12:00

Merge remote-tracking branch 'origin/feat-fixes-for-pools' into feat-usage-refactor-fo-db-pools

This commit is contained in:
Damodar Lohani 2022-11-06 08:10:01 +00:00
commit 5756a7e117
10 changed files with 45 additions and 59 deletions

View file

@ -1003,7 +1003,7 @@ $collections = [
'$id' => ID::custom('secret'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 512, // var_dump of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption
'size' => 512, // Output of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption
'signed' => true,
'required' => true,
'default' => null,

View file

@ -1575,7 +1575,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes')
Query::equal('databaseInternalId', [$db->getInternalId()])
], 61);
$limit = 64 - MariaDB::getCountOfDefaultIndexes();
$limit = $dbForProject->getLimitForIndexes();
if ($count >= $limit) {
throw new Exception(Exception::INDEX_LIMIT_EXCEEDED, 'Index limit exceeded');

View file

@ -61,7 +61,6 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) {
$app = new App('UTC');
go(function () use ($register, $app) {
$pools = $register->get('pools'); /** @var Group $pools */
App::setResource('pools', fn() => $pools);
@ -119,7 +118,7 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) {
/**
* Skip to prevent 0.16 migration issues.
*/
if (in_array($key, ['cache', 'variables']) && $dbForConsole->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), 'bucket_1')) {
if (in_array($key, ['cache', 'variables']) && $dbForConsole->exists($dbForConsole->getDefaultDatabase(), 'bucket_1')) {
continue;
}
@ -155,7 +154,7 @@ $http->on('start', function (Server $http) use ($payloadSize, $register) {
$dbForConsole->createCollection($key, $attributes, $indexes);
}
if ($dbForConsole->getDocument('buckets', 'default')->isEmpty() && !$dbForConsole->exists(App::getEnv('_APP_DB_SCHEMA', 'appwrite'), 'bucket_1')) {
if ($dbForConsole->getDocument('buckets', 'default')->isEmpty() && !$dbForConsole->exists($dbForConsole->getDefaultDatabase(), 'bucket_1')) {
Console::success('[Setup] - Creating default bucket...');
$dbForConsole->createDocument('buckets', new Document([
'$id' => ID::custom('default'),

View file

@ -65,7 +65,6 @@ use Utopia\Storage\Device\Wasabi;
use Utopia\Cache\Adapter\Redis as RedisCache;
use Utopia\Cache\Adapter\Sharding;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
use Utopia\Database\Adapter\MariaDB;
use Utopia\Database\Adapter\MySQL;
use Utopia\Pools\Group;
@ -498,7 +497,6 @@ $register->set('logger', function () {
return new Logger($adapter);
});
$register->set('pools', function () {
$group = new Group();
$fallbackForDB = AppwriteURL::unparse([
@ -634,7 +632,6 @@ $register->set('pools', function () {
default => null
};
var_dump($dsn->getDatabase());
$adapter->setDefaultDatabase($dsn->getDatabase());
break;
@ -665,12 +662,6 @@ $register->set('pools', function () {
Config::setParam('pools-' . $key, $config);
}
try {
$group->fill();
} catch (\Throwable $th) {
Console::error('Connection failure: ' . $th->getMessage());
}
return $group;
});
$register->set('influxdb', function () {

View file

@ -35,7 +35,7 @@ foreach (
realpath(__DIR__ . '/../vendor/symfony'),
realpath(__DIR__ . '/../vendor/mongodb'),
realpath(__DIR__ . '/../vendor/utopia-php/websocket'), // TODO: remove workerman autoload
realpath(__DIR__ . '/../vendor/utopia-php/cache'), // TODO: remove memcache autoload
realpath(__DIR__ . '/../vendor/utopia-php/cache'), // TODO: remove memcached autoload
] as $key => $value
) {
if ($value !== false) {

View file

@ -32,7 +32,6 @@ require_once __DIR__ . '/init.php';
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
function getConsoleDB(): Database
{
global $register;

View file

@ -206,7 +206,7 @@ $cli
unset($models[$key]);
}
}
// var_dump($models);
$arguments = [new App('UTC'), $services, $routes, $models, $keys[$platform], $authCounts[$platform] ?? 0];
foreach (['swagger2', 'open-api3'] as $format) {
$formatInstance = match ($format) {

View file

@ -43,12 +43,12 @@
"ext-sockets": "*",
"appwrite/php-clamav": "1.1.*",
"appwrite/php-runtimes": "0.11.*",
"utopia-php/framework": "0.21.*",
"utopia-php/framework": "0.23.*",
"utopia-php/logger": "0.3.*",
"utopia-php/abuse": "0.16.*",
"utopia-php/analytics": "0.2.*",
"utopia-php/audit": "0.17.*",
"utopia-php/cache": "0.8.*",
"utopia-php/audit": "0.17.*",
"utopia-php/cli": "0.13.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.28.*",
@ -56,12 +56,12 @@
"utopia-php/registry": "0.5.*",
"utopia-php/preloader": "0.2.*",
"utopia-php/domains": "1.1.*",
"utopia-php/swoole": "0.3.*",
"utopia-php/swoole": "0.5.*",
"utopia-php/storage": "0.11.*",
"utopia-php/websocket": "0.1.0",
"utopia-php/image": "0.5.*",
"utopia-php/orchestration": "0.6.*",
"utopia-php/pools": "0.1.*",
"utopia-php/pools": "dev-feat-optimize-filling as 0.3.0",
"resque/php-resque": "1.3.6",
"matomo/device-detector": "6.0.0",
"dragonmantank/cron-expression": "3.3.1",

71
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e44426d5884ef97987ebbb711a9ee189",
"content-hash": "1c15c309c6fcefe30360915fdac8adad",
"packages": [
{
"name": "adhocore/jwt",
@ -1879,24 +1879,24 @@
},
{
"name": "utopia-php/framework",
"version": "0.21.1",
"version": "0.23.4",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/framework.git",
"reference": "c81789b87a917da2daf336738170ebe01f50ea18"
"reference": "97f64aa1732af92b967c3576f16967dc762ad47b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/c81789b87a917da2daf336738170ebe01f50ea18",
"reference": "c81789b87a917da2daf336738170ebe01f50ea18",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/97f64aa1732af92b967c3576f16967dc762ad47b",
"reference": "97f64aa1732af92b967c3576f16967dc762ad47b",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10",
"vimeo/psalm": "4.13.1"
"phpunit/phpunit": "^9.5.25",
"vimeo/psalm": "^4.27.0"
},
"type": "library",
"autoload": {
@ -1908,12 +1908,6 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Eldad Fux",
"email": "eldad@appwrite.io"
}
],
"description": "A simple, light and advanced PHP framework",
"keywords": [
"framework",
@ -1922,9 +1916,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/framework/issues",
"source": "https://github.com/utopia-php/framework/tree/0.21.1"
"source": "https://github.com/utopia-php/framework/tree/0.23.4"
},
"time": "2022-09-07T09:56:28+00:00"
"time": "2022-10-31T11:57:14+00:00"
},
{
"name": "utopia-php/image",
@ -2152,23 +2146,24 @@
},
{
"name": "utopia-php/pools",
"version": "0.1.0",
"version": "dev-feat-optimize-filling",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/pools.git",
"reference": "5a467a569a80aefc846a97dc195b4adc2fd71805"
"reference": "be603898142f55df9db5058f81a610ead7769d7d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/pools/zipball/5a467a569a80aefc846a97dc195b4adc2fd71805",
"reference": "5a467a569a80aefc846a97dc195b4adc2fd71805",
"url": "https://api.github.com/repos/utopia-php/pools/zipball/be603898142f55df9db5058f81a610ead7769d7d",
"reference": "be603898142f55df9db5058f81a610ead7769d7d",
"shasum": ""
},
"require": {
"ext-mongodb": "*",
"ext-pdo": "*",
"ext-redis": "*",
"php": ">=8.0"
"php": ">=8.0",
"utopia-php/cli": "^0.13.0"
},
"require-dev": {
"phpunit/phpunit": "^9.4",
@ -2199,9 +2194,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/pools/issues",
"source": "https://github.com/utopia-php/pools/tree/0.1.0"
"source": "https://github.com/utopia-php/pools/tree/feat-optimize-filling"
},
"time": "2022-10-11T19:31:07+00:00"
"time": "2022-11-03T18:50:28+00:00"
},
{
"name": "utopia-php/preloader",
@ -2365,16 +2360,16 @@
},
{
"name": "utopia-php/swoole",
"version": "0.3.3",
"version": "0.5.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/swoole.git",
"reference": "8312df69233b5dcd3992de88f131f238002749de"
"reference": "c2a3a4f944a2f22945af3cbcb95b13f0769628b1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/8312df69233b5dcd3992de88f131f238002749de",
"reference": "8312df69233b5dcd3992de88f131f238002749de",
"url": "https://api.github.com/repos/utopia-php/swoole/zipball/c2a3a4f944a2f22945af3cbcb95b13f0769628b1",
"reference": "c2a3a4f944a2f22945af3cbcb95b13f0769628b1",
"shasum": ""
},
"require": {
@ -2383,6 +2378,7 @@
"utopia-php/framework": "0.*.*"
},
"require-dev": {
"laravel/pint": "1.2.*",
"phpunit/phpunit": "^9.3",
"swoole/ide-helper": "4.8.3",
"vimeo/psalm": "4.15.0"
@ -2397,12 +2393,6 @@
"license": [
"MIT"
],
"authors": [
{
"name": "Eldad Fux",
"email": "team@appwrite.io"
}
],
"description": "An extension for Utopia Framework to work with PHP Swoole as a PHP FPM alternative",
"keywords": [
"framework",
@ -2415,9 +2405,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/swoole/issues",
"source": "https://github.com/utopia-php/swoole/tree/0.3.3"
"source": "https://github.com/utopia-php/swoole/tree/0.5.0"
},
"time": "2022-01-20T09:58:43+00:00"
"time": "2022-10-19T22:19:07+00:00"
},
{
"name": "utopia-php/system",
@ -5117,9 +5107,18 @@
"time": "2022-09-28T08:42:51+00:00"
}
],
"aliases": [],
"aliases": [
{
"package": "utopia-php/pools",
"version": "dev-feat-optimize-filling",
"alias": "0.3.0",
"alias_normalized": "0.3.0.0"
}
],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"utopia-php/pools": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {

View file

@ -362,7 +362,6 @@ services:
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
#- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
depends_on:
- redis
- mariadb
@ -620,7 +619,6 @@ services:
volumes:
- ./app:/usr/src/code/app
- ./src:/usr/src/code/src
#- ./vendor/utopia-php/database:/usr/src/code/vendor/utopia-php/database
depends_on:
- redis
environment: