diff --git a/app/workers/functions.php b/app/workers/functions.php index 63ae99290..3916ffbd7 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -264,9 +264,9 @@ class FunctionsV1 $exitCode = Console::execute("docker run \ -d \ - --cpus=1 \ - --memory=50m \ - --memory-swap=50m \ + --cpus=4 \ + --memory=128m \ + --memory-swap=128m \ --rm \ --name={$container} \ --label appwrite-type=function \ diff --git a/public/dist/scripts/app-all.js b/public/dist/scripts/app-all.js index 652299ffb..31778295e 100644 --- a/public/dist/scripts/app-all.js +++ b/public/dist/scripts/app-all.js @@ -2625,7 +2625,7 @@ return value+" "+unit+" "+direction;}).add("ms2hum",function($value){let temp=$v (hours?hours+"h ":"")+ (minutes?minutes+"m ":"")+ Number.parseFloat(seconds).toFixed(0)+"s");} -return"< 1s";}).add("seconds2hum",function($value){var seconds=($value).toFixed(2);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d"}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;} +return"< 1s";}).add("seconds2hum",function($value){var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d"}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;} let thresh=1000;if(Math.abs($value)=thresh&&u'+ units[u]+"");}).add("statsTotal",function($value){if(!$value){return 0;} diff --git a/public/dist/scripts/app.js b/public/dist/scripts/app.js index 6005f74ec..e7ba4a763 100644 --- a/public/dist/scripts/app.js +++ b/public/dist/scripts/app.js @@ -263,7 +263,7 @@ return value+" "+unit+" "+direction;}).add("ms2hum",function($value){let temp=$v (hours?hours+"h ":"")+ (minutes?minutes+"m ":"")+ Number.parseFloat(seconds).toFixed(0)+"s");} -return"< 1s";}).add("seconds2hum",function($value){var seconds=($value).toFixed(2);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d"}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;} +return"< 1s";}).add("seconds2hum",function($value){var seconds=($value).toFixed(3);var minutes=($value/(60)).toFixed(1);var hours=($value/(60*60)).toFixed(1);var days=($value/(60*60*24)).toFixed(1);if(seconds<60){return seconds+"s";}else if(minutes<60){return minutes+"m";}else if(hours<24){return hours+"h";}else{return days+"d"}}).add("markdown",function($value,markdown){return markdown.render($value);}).add("pageCurrent",function($value,env){return Math.ceil(parseInt($value||0)/env.PAGING_LIMIT)+1;}).add("pageTotal",function($value,env){let total=Math.ceil(parseInt($value||0)/env.PAGING_LIMIT);return total?total:1;}).add("humanFileSize",function($value){if(!$value){return 0;} let thresh=1000;if(Math.abs($value)=thresh&&u'+ units[u]+"");}).add("statsTotal",function($value){if(!$value){return 0;} diff --git a/public/scripts/filters.js b/public/scripts/filters.js index e068fe117..9f5308d55 100644 --- a/public/scripts/filters.js +++ b/public/scripts/filters.js @@ -97,7 +97,7 @@ window.ls.filter }) .add("seconds2hum", function($value) { - var seconds = ($value).toFixed(2); + var seconds = ($value).toFixed(3); var minutes = ($value / (60)).toFixed(1); diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 8a2938178..754732aa8 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -191,9 +191,9 @@ class FunctionsConsoleServerTest extends Scope $this->assertEquals(201, $tag['headers']['status-code']); $this->assertNotEmpty($tag['body']['$id']); $this->assertIsInt($tag['body']['dateCreated']); - $this->assertEquals('node ./test.js', $tag['body']['command']); + $this->assertEquals('php function.php', $tag['body']['command']); $this->assertStringStartsWith('/storage/functions/app-', $tag['body']['codePath']); - $this->assertEquals(521, $tag['body']['codeSize']); + $this->assertEquals(751, $tag['body']['codeSize']); /** * Test for FAILURE diff --git a/tests/resources/functions/php-fx.gz b/tests/resources/functions/php-fx.tar.gz similarity index 100% rename from tests/resources/functions/php-fx.gz rename to tests/resources/functions/php-fx.tar.gz