Skip to content

Commit 87737a1

Browse files
committed
Use warmup for the new packager
1 parent 8dbceca commit 87737a1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/app/src/sandbox/npm/fetch-dependencies.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,25 @@ const VERSION = 1;
1818

1919
const BUCKET_URL =
2020
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
21-
? 'https://prod-packager-packages.codesandbox.io'
21+
? 'https://d1jyvh0kxilfa7.cloudfront.net'
2222
: 'https://dev-packager-packages.codesandbox.io';
2323

24+
const NEW_PACKAGER_URL =
25+
'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages';
26+
2427
const PACKAGER_URL =
2528
process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'test'
26-
? 'https://aiwi8rnkp5.execute-api.eu-west-1.amazonaws.com/prod/packages'
29+
? 'https://drq28qbjmc.execute-api.eu-west-1.amazonaws.com/prod/packages'
2730
: 'https://xi5p9f7czk.execute-api.eu-west-1.amazonaws.com/dev/packages';
2831

32+
function warmupPackager(url: string, method = 'GET') {
33+
fetch(url, {
34+
method,
35+
})
36+
.then(() => {})
37+
.catch(() => {});
38+
}
39+
2940
function callApi(url: string, method = 'GET') {
3041
return fetch(url, {
3142
method,
@@ -111,6 +122,7 @@ async function getDependencies(dependencies: Object) {
111122
const bucketDependencyUrl = dependenciesToBucketPath(absoluteDependencies);
112123

113124
setScreen({ type: 'loading', text: 'Downloading Dependencies...' });
125+
warmupPackager(`${NEW_PACKAGER_URL}/${dependencyUrl}`, 'POST');
114126
try {
115127
const bucketManifest = await callApi(
116128
`${BUCKET_URL}/${bucketDependencyUrl}`

0 commit comments

Comments
 (0)