diff --git a/src/Appwrite/Compute/Job.php b/src/Appwrite/Compute/Job.php index ac8d2ce84e..0dcd4e3a93 100644 --- a/src/Appwrite/Compute/Job.php +++ b/src/Appwrite/Compute/Job.php @@ -78,7 +78,7 @@ final class Job // so unlike the uploaded-tarball path it can't size it. Stat the // downloaded archive so the orchestrator reports its byte size in // an artifact callback, which the worker records as sourceSize. - new StatArtifact(id: 'sourceSize', in: 'source.tar.gz', depends: 'source'), + new StatArtifact(id: 'sourceSize', in: 'source.tar.gz', depends: 'job'), ]; } else { // Presigned source-download URL (GET, no request-body cap), fetched by diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php b/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php index 61a4e6db60..500998cd93 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php @@ -168,14 +168,12 @@ class Jobs extends Action */ private function onArtifact(Database $dbForProject, Document $deployment, array $data): Document { - if (($data['id'] ?? '') !== 'sourceSize') { + if (($data['artifactId'] ?? '') !== 'sourceSize' || ($data['status'] ?? '') !== 'success') { return $deployment; } - // The stat callback payload shape is still settling upstream; accept the - // size flat or nested under 'stat'. - $stat = \is_array($data['stat'] ?? null) ? $data['stat'] : $data; - $size = (int) ($stat['size'] ?? $stat['bytes'] ?? 0); + // A stat artifact reports the file's byte size as its 'content'. + $size = (int) ($data['content'] ?? 0); if ($size <= 0) { return $deployment; }