Script fetching Nimbledroid data should return a proper exit code
See this issue for details: https://github.com/mozilla/firefox-health-dashboard/issues/132#issuecomment-419163074 We also add more verbosity and build the project before calling the script to reflect code changes to the script.
This commit is contained in:
Родитель
efeb57bf87
Коммит
668d358922
|
@ -15,7 +15,7 @@
|
|||
"start:debugger": "neutrino build && node --inspect .",
|
||||
"precommit": "lint-staged",
|
||||
"heroku-postbuild": "npm run build",
|
||||
"fetchNimbledroidData": "node build/nimbledroid.js"
|
||||
"fetchNimbledroidData": "neutrino build && node build/nimbledroid.js"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
|
|
|
@ -35,6 +35,8 @@ const storeProfilingRunIfMissing = async (profilingRunData) => {
|
|||
if (!cached) {
|
||||
console.log(`Storing ${key}`);
|
||||
await redisClient.set(key, JSON.stringify(profilingRunData));
|
||||
} else {
|
||||
console.log(`The key is already in the cache (${key})`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -48,17 +50,20 @@ const fetchData = async productName =>
|
|||
nimbledroidClient.getNimbledroidData(productName);
|
||||
|
||||
const main = async () => {
|
||||
let errorCode = -1;
|
||||
console.log('Fetching each product can take between 20-40 seconds.');
|
||||
try {
|
||||
await Promise.all(['klar', 'focus'].map(async (productName) => {
|
||||
console.log(`Fetching ${productName}`);
|
||||
const productData = await fetchData(productName);
|
||||
console.log(`Storing ${productName}`);
|
||||
await storeDataInRedis(productData);
|
||||
}));
|
||||
errorCode = 0;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
process.exit();
|
||||
process.exit(errorCode);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче