catch errors while filling the cache

This commit is contained in:
Daniel Sommer 2022-03-10 00:36:59 +01:00
parent dc01956269
commit 5f9074e086

View file

@ -25,15 +25,20 @@ async function fill() {
const timestamp = new Date();
logger.debug('filling cache...');
clear();
if (modep === undefined) {
modep = require('./modep.js');
try {
if (modep === undefined) {
modep = require('./modep.js');
}
await modep.getBanks();
await modep.getPedalboards();
await modep.getDefaultPedalboard();
await modep.getCurrentPedalboard();
await modep.getCurrentPedals();
logger.debug('cache filled after ' + timeDiff(timestamp) + 'ms');
} catch (err) {
logger.error('encountered an error while filling the cache after ' + timeDiff(timestamp) + 'ms');
}
await modep.getBanks();
await modep.getPedalboards();
await modep.getDefaultPedalboard();
await modep.getCurrentPedalboard();
await modep.getCurrentPedals();
logger.debug('cache filled after ' + timeDiff(timestamp) + 'ms');
}
function clear() {