fix: refs #8657 test await printer server
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
186219f057
commit
acf0f82d85
|
@ -17,7 +17,7 @@ async function init() {
|
|||
});
|
||||
// FIXME: Workaround to wait for loopback to be ready
|
||||
app.emit('started');
|
||||
await app.models.Application.status();
|
||||
await getStatus();
|
||||
}
|
||||
|
||||
async function deinit() {
|
||||
|
@ -33,3 +33,20 @@ module.exports = {
|
|||
if (require.main === module)
|
||||
init();
|
||||
|
||||
async function getStatus() {
|
||||
const MAX_ATTEMPTS = 10;
|
||||
let attempts = 0;
|
||||
return new Promise((resolve, reject) => {
|
||||
const intervalo = setInterval(async() => {
|
||||
try {
|
||||
const resultado = await app.models.Application.status();
|
||||
clearInterval(intervalo);
|
||||
resolve(resultado);
|
||||
} catch (error) {
|
||||
console.log('Attempt to connect ' + attempts + '/' + MAX_ATTEMPTS);
|
||||
if (attempts >= MAX_ATTEMPTS)reject(error);
|
||||
}
|
||||
attempts++;
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue