Skip to content

Commit

Permalink
Implement chunk read/writes to storage
Browse files Browse the repository at this point in the history
  • Loading branch information
Meldiron committed Sep 18, 2023
1 parent f86f1a0 commit bcafcd3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app/http.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
}
Expand Down Expand Up @@ -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);
};

Expand Down

0 comments on commit bcafcd3

Please sign in to comment.