From bcafcd30fab7844baef2b89d3c9c3adada7073d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 18 Sep 2023 12:20:09 +0200 Subject: [PATCH] Implement chunk read/writes to storage --- app/http.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/http.php b/app/http.php index cf964dbb..3dd6c56a 100644 --- a/app/http.php +++ b/app/http.php @@ -429,8 +429,7 @@ function removeAllRuntimes(Table $activeRuntimes, Orchestration $orchestration): * Copy code files from source to a temporary location on the executor */ if (!empty($source)) { - $buffer = $sourceDevice->read($source); - if (!$localDevice->write($tmpSource, $buffer)) { + if (!$localDevice->transfer($source, $tmpSource, $sourceDevice)) { throw new Exception('Failed to copy source code to temporary directory', 500); }; } @@ -537,9 +536,8 @@ function removeAllRuntimes(Table $activeRuntimes, Orchestration $orchestration): $destinationDevice = getStorageDevice($destination); $path = $destinationDevice->getPath(\uniqid() . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); - $buffer = $localDevice->read($tmpBuild); - if (!$destinationDevice->write($path, $buffer, $localDevice->getFileMimeType($tmpBuild))) { + if (!$localDevice->transfer($tmpBuild, $path, $destinationDevice)) { throw new Exception('Failed to move built code to storage', 500); };