sdfsdf
This commit is contained in:
@@ -14,7 +14,7 @@ class SeleniumBrowser {
|
||||
let uri = params.uri
|
||||
logger.info('URL %s', uri)
|
||||
if (uri.indexOf('://') > 3) {
|
||||
return this.pool.acquire()
|
||||
return poolingService.acquire()
|
||||
.then(async driver => {
|
||||
let html = await driver.get(uri)
|
||||
.then(() => driver.findElement(By.css('body')))
|
||||
|
||||
@@ -12,22 +12,26 @@ class PoolingService {
|
||||
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.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() {
|
||||
|
||||
Reference in New Issue
Block a user