Give more time to setting up containers

This commit is contained in:
1computer1 2019-05-20 14:55:23 -04:00
parent 71079ceb19
commit 567ca0322a

View file

@ -107,7 +107,7 @@ class LanguageHandler extends AkairoHandler {
]); ]);
try { try {
const result = await this.handleSpawn(proc); const result = await this.handleSpawn(proc, true);
return result; return result;
} catch (err) { } catch (err) {
this.containers.delete(dockerID); this.containers.delete(dockerID);
@ -117,11 +117,13 @@ class LanguageHandler extends AkairoHandler {
}); });
} }
handleSpawn(proc) { handleSpawn(proc, withTimeout = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { if (withTimeout) {
reject(new Error('Timed out')); setTimeout(() => {
}, this.client.config.timeout); reject(new Error('Timed out'));
}, this.client.config.timeout);
}
let data = ''; let data = '';
proc.stdout.on('data', chunk => { proc.stdout.on('data', chunk => {