This commit is contained in:
brow3c
2021-05-15 19:13:30 +09:00
parent b34ab575a6
commit bcd47c712c
2 changed files with 13 additions and 9 deletions

View File

@@ -11,23 +11,27 @@ class PoolingService {
browser: 'chrome',
browserArgs: ['--no-sandbox', '--headless', '--disable-dev-shm-usage', '--proxy-server=spiduler-tor:8118']
}
this.pool = this.createPool()
this.pool.on("factoryCreateError", function (err) {
console.log('factoryCreateError', err);
});
this.pool = this.createPool()
}
this.pool.on("factoryDestroyError", function (err) {
console.log('factoryDestroyError', err);
});
acquire() {
return this.pool.acquire().catch(err => this.pool.acquire())
}
createPool() {
setInterval(() => this.debugPoolStatus(), 1000 * 60 * 5)
return pool.createPool({
let pool = pool.createPool({
create: () => this.create(),
destroy: (driver) => this.destroy(driver),
validate: (driver) => this.validate(driver)
}, this.config.pool);
this.pool.on("factoryCreateError", function (err) {
logger.debug({reason: err.message}, 'factoryCreateError');
});
this.pool.on("factoryDestroyError", function (err) {
logger.debug({reason: err.message}, 'factoryDestroyError');
});
return pool
}
create() {