Skip to content

Commit e0c29f2

Browse files
author
Yuan Huang
committed
fix: remove node_modules from /infrabox/cache to prevent timeout
The real bottleneck was not cp -r in build.sh but job.py's post-build step that compresses and uploads /infrabox/cache via snappy+tar to the API server. With node:20's much larger node_modules (~200MB+), this compression/upload exceeds the 1-hour job timeout. Solution: stop writing node_modules back to /infrabox/cache. Instead, use mv to restore cached node_modules at the start (fast), and don't write it back (npm install with warm cache only takes ~20s anyway). This eliminates the expensive cache upload entirely.
1 parent 215ed8e commit e0c29f2

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/dashboard-client/build.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
cp -r /infrabox/context/src/dashboard-client /dashboard
33

44
echo "## Link cache"
5-
mkdir -p /infrabox/cache/node_modules
6-
tar -C /infrabox/cache -cf - node_modules | tar -C /dashboard -xf -
5+
if [ -d /infrabox/cache/node_modules ]; then
6+
mv /infrabox/cache/node_modules /dashboard/node_modules
7+
else
8+
mkdir -p /dashboard/node_modules
9+
fi
710

811
cd /dashboard
912

@@ -15,10 +18,6 @@ npm install
1518
echo "## build"
1619
npm run build
1720

18-
echo "## Copy to cache"
19-
rm -rf /infrabox/cache/node_modules
20-
tar -C /dashboard -cf - node_modules | tar -C /infrabox/cache -xf -
21-
2221
echo "## Copy to output"
2322
cp -r /dashboard/dist /infrabox/output
2423

0 commit comments

Comments
 (0)