handle exception and restart pullingafter timeout
This commit is contained in:
parent
5b923badf7
commit
41e2f9a2ab
13
service.js
13
service.js
@ -238,7 +238,15 @@ async function onStateChange(consumer_id, status_id){
|
||||
}
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
async function startAPI() {
|
||||
while(True){
|
||||
try{
|
||||
let _auth = await auth()
|
||||
if(_auth){
|
||||
global.logger.info('auth OK')
|
||||
@ -274,5 +282,10 @@ async function startAPI() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(err){
|
||||
console.error(err);
|
||||
}
|
||||
await sleep(10000);
|
||||
global.logger.info('auth mit API_KEY war nicht erfolgreich. Service ist gestoppt und startet nicht mehr automatisch??')
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user