dsfd
This commit is contained in:
@@ -15,6 +15,18 @@ class SeleniumBrowser {
|
|||||||
}
|
}
|
||||||
this.capabilities = Capabilities.chrome()
|
this.capabilities = Capabilities.chrome()
|
||||||
this.sleep = m => new Promise(r => setTimeout(r, m))
|
this.sleep = m => new Promise(r => setTimeout(r, m))
|
||||||
|
setInterval(this.createPool, 1000 * 60)
|
||||||
|
}
|
||||||
|
|
||||||
|
reCreatePool() {
|
||||||
|
this.pool.drain().then(() => {
|
||||||
|
return this.pool.clear()
|
||||||
|
}).then(() => {
|
||||||
|
this.createPool()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
createPool() {
|
||||||
this.pool = pool.createPool({
|
this.pool = pool.createPool({
|
||||||
create: () => {
|
create: () => {
|
||||||
logger.info('Create new driver instance')
|
logger.info('Create new driver instance')
|
||||||
@@ -31,7 +43,7 @@ class SeleniumBrowser {
|
|||||||
pending: this.pool.pending
|
pending: this.pool.pending
|
||||||
}, 'Pool info')
|
}, 'Pool info')
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
logger.debug({message: err.message}, 'Quitting error')
|
logger.debug({ message: err.message }, 'Quitting error')
|
||||||
this.pool.release(driver)
|
this.pool.release(driver)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user