diff --git a/CHANGES.md b/CHANGES.md index 1317a3480..e95a225b8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +# Version 0.10.4 + +## Bugs +- Fixed another memory leak in realtime service (#1627) + # Version 0.10.3 ## Bugs diff --git a/README.md b/README.md index 9fb228412..2509a6ee2 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:0.10.3 + appwrite/appwrite:0.10.4 ``` ### Windows @@ -69,7 +69,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:0.10.3 + appwrite/appwrite:0.10.4 ``` #### PowerShell @@ -79,7 +79,7 @@ docker run -it --rm , --volume /var/run/docker.sock:/var/run/docker.sock , --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw , --entrypoint="install" , - appwrite/appwrite:0.10.3 + appwrite/appwrite:0.10.4 ``` Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-linux native hosts, the server might take a few minutes to start after installation completes. diff --git a/app/init.php b/app/init.php index 1e38e734a..8c1d6cb45 100644 --- a/app/init.php +++ b/app/init.php @@ -49,7 +49,7 @@ const APP_MODE_DEFAULT = 'default'; const APP_MODE_ADMIN = 'admin'; const APP_PAGING_LIMIT = 12; const APP_CACHE_BUSTER = 160; -const APP_VERSION_STABLE = '0.10.3'; +const APP_VERSION_STABLE = '0.10.4'; const APP_STORAGE_UPLOADS = '/storage/uploads'; const APP_STORAGE_FUNCTIONS = '/storage/functions'; const APP_STORAGE_CACHE = '/storage/cache'; diff --git a/app/realtime.php b/app/realtime.php index 40537ea61..70eacc0d4 100644 --- a/app/realtime.php +++ b/app/realtime.php @@ -103,8 +103,6 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId) * Save current connections to the Database every 5 seconds. */ Timer::tick(5000, function () use ($stats, $getConsoleDb, $containerId, &$documentId) { - [$consoleDb, $returnConsoleDb] = call_user_func($getConsoleDb); - foreach ($stats as $projectId => $value) { if (empty($value['connections']) && empty($value['messages'])) { continue; @@ -129,8 +127,6 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId) if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') { $usage->trigger(); } - - unset($usage, $connections, $messages); } $payload = []; foreach ($stats as $projectId => $value) { @@ -141,19 +137,21 @@ $server->onStart(function () use ($stats, $register, $containerId, &$documentId) if (empty($payload)) { return; } - $document = [ - '$id' => $documentId, - '$collection' => Database::SYSTEM_COLLECTION_CONNECTIONS, - '$permissions' => [ - 'read' => ['*'], - 'write' => ['*'], - ], - 'container' => $containerId, - 'timestamp' => time(), - 'value' => json_encode($payload) - ]; + try { - $document = $consoleDb->updateDocument($document); + [$consoleDb, $returnConsoleDb] = call_user_func($getConsoleDb); + + $consoleDb->updateDocument([ + '$id' => $documentId, + '$collection' => Database::SYSTEM_COLLECTION_CONNECTIONS, + '$permissions' => [ + 'read' => ['*'], + 'write' => ['*'], + ], + 'container' => $containerId, + 'timestamp' => time(), + 'value' => json_encode($payload) + ]); } catch (\Throwable $th) { Console::error('[Error] Type: ' . get_class($th)); Console::error('[Error] Message: ' . $th->getMessage()); diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index b7aac0392..2ab1ce4fd 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -47,6 +47,7 @@ abstract class Migration '0.10.1' => 'V09', '0.10.2' => 'V09', '0.10.3' => 'V09', + '0.10.4' => 'V09', ]; /**