1
0
Fork 0
mirror of synced 2024-05-29 08:59:50 +12:00

Fix Native Labels

This commit is contained in:
Bradley Schofield 2021-07-23 10:05:59 +01:00
parent b043ccde48
commit a4875cfd22
2 changed files with 88 additions and 27 deletions

View file

@ -63,7 +63,7 @@ $stderr = '';
$executionStart = \microtime(true);
$response = $orchestration->list(['labels' => 'appwrite-type=function']);
$response = $orchestration->list(['label' => 'appwrite-type=function']);
$list = [];
@ -499,15 +499,15 @@ class FunctionsV1 extends Worker
Console::info('Starting containers cleanup');
\uasort($list, function ($item1, $item2) {
return (int)($item1->labels['appwrite-created'] ?? 0) <=> (int)($item2->labels['appwrite-created'] ?? 0);
return (int)($item1->getLabels['appwrite-created'] ?? 0) <=> (int)($item2->getLabels['appwrite-created'] ?? 0);
});
while(\count($list) > $max) {
$first = \array_shift($list);
try {
$orchestration->remove($first->name, true);
Console::info('Removed container: '.$first->name);
$orchestration->remove($first->getName(), true);
Console::info('Removed container: '.$first->getName());
} catch (Exception $e) {
Console::error('Failed to remove container: '.$e);
}

107
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": "e24aacead283e33130051470bb4312e6",
"content-hash": "e30c92bf02f5aa68c1fd67aa985a7949",
"packages": [
{
"name": "adhocore/jwt",
@ -1907,6 +1907,64 @@
},
"time": "2020-10-24T08:12:55+00:00"
},
{
"name": "utopia-php/orchestration",
"version": "dev-dev",
"source": {
"type": "git",
"url": "https://github.com/PineappleIOnic/orchestration.git",
"reference": "b691209cd68392553fe38a57bcb7c274a4c56ead"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PineappleIOnic/orchestration/zipball/b691209cd68392553fe38a57bcb7c274a4c56ead",
"reference": "b691209cd68392553fe38a57bcb7c274a4c56ead",
"shasum": ""
},
"require": {
"php": ">=8.0",
"utopia-php/cli": "0.11.*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"vimeo/psalm": "4.0.1"
},
"type": "library",
"autoload": {
"psr-4": {
"Utopia\\Orchestration\\": "src/Orchestration"
}
},
"autoload-dev": {
"psr-4": {
"Utopia\\Tests\\": "tests/Orchestration"
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Eldad Fux",
"email": "eldad@appwrite.io"
}
],
"description": "Lite & fast micro PHP abstraction library for container orchestration",
"keywords": [
"docker",
"framework",
"kubernetes",
"orchestration",
"php",
"swarm",
"upf",
"utopia"
],
"support": {
"source": "https://github.com/PineappleIOnic/orchestration/tree/dev"
},
"time": "2021-07-23T08:43:52+00:00"
},
{
"name": "utopia-php/preloader",
"version": "0.2.4",
@ -2237,27 +2295,27 @@
"packages-dev": [
{
"name": "amphp/amp",
"version": "v2.5.2",
"version": "v2.6.0",
"source": {
"type": "git",
"url": "https://github.com/amphp/amp.git",
"reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9"
"reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/amp/zipball/efca2b32a7580087adb8aabbff6be1dc1bb924a9",
"reference": "efca2b32a7580087adb8aabbff6be1dc1bb924a9",
"url": "https://api.github.com/repos/amphp/amp/zipball/caa95edeb1ca1bf7532e9118ede4a3c3126408cc",
"reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc",
"shasum": ""
},
"require": {
"php": ">=7"
"php": ">=7.1"
},
"require-dev": {
"amphp/php-cs-fixer-config": "dev-master",
"amphp/phpunit-util": "^1",
"ext-json": "*",
"jetbrains/phpstorm-stubs": "^2019.3",
"phpunit/phpunit": "^6.0.9 | ^7",
"phpunit/phpunit": "^7 | ^8 | ^9",
"psalm/phar": "^3.11@dev",
"react/promise": "^2"
},
@ -2314,7 +2372,7 @@
"support": {
"irc": "irc://irc.freenode.org/amphp",
"issues": "https://github.com/amphp/amp/issues",
"source": "https://github.com/amphp/amp/tree/v2.5.2"
"source": "https://github.com/amphp/amp/tree/v2.6.0"
},
"funding": [
{
@ -2322,7 +2380,7 @@
"type": "github"
}
],
"time": "2021-01-10T17:06:37+00:00"
"time": "2021-07-16T20:06:06+00:00"
},
{
"name": "amphp/byte-stream",
@ -3117,16 +3175,16 @@
},
{
"name": "nikic/php-parser",
"version": "v4.11.0",
"version": "v4.12.0",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "fe14cf3672a149364fb66dfe11bf6549af899f94"
"reference": "6608f01670c3cc5079e18c1dab1104e002579143"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/fe14cf3672a149364fb66dfe11bf6549af899f94",
"reference": "fe14cf3672a149364fb66dfe11bf6549af899f94",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143",
"reference": "6608f01670c3cc5079e18c1dab1104e002579143",
"shasum": ""
},
"require": {
@ -3167,9 +3225,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.11.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0"
},
"time": "2021-07-03T13:36:55+00:00"
"time": "2021-07-21T10:44:31+00:00"
},
{
"name": "openlss/lib-array2xml",
@ -3226,16 +3284,16 @@
},
{
"name": "phar-io/manifest",
"version": "2.0.1",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133"
"reference": "97803eca37d319dfa7826cc2437fc020857acb53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133",
"reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53",
"shasum": ""
},
"require": {
@ -3280,9 +3338,9 @@
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/master"
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
},
"time": "2020-06-27T14:33:11+00:00"
"time": "2021-07-20T11:28:43+00:00"
},
{
"name": "phar-io/version",
@ -4882,6 +4940,7 @@
"type": "github"
}
],
"abandoned": true,
"time": "2020-09-28T06:45:17+00:00"
},
{
@ -6066,7 +6125,9 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {
"utopia-php/orchestration": 20
},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -6088,5 +6149,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.0.0"
"plugin-api-version": "2.1.0"
}