This commit is contained in:
spiduler
2020-10-23 15:44:56 +09:00
parent c2866e5cb1
commit a4b98a6298

View File

@@ -47,13 +47,15 @@ class SeleniumBrowser {
})
this.pool.use(driver => {
if(this.pool.available == 0) browserFullCount++
if(browserFullCount > 100) {
this.pool.clear()
}
return driver.getSession().then(s => driver).catch(err => {
this.pool.destroy(driver)
throw new Error('Driver session expired pool should create new instance')
return new Promise((resolve, reject) => {
if(this.pool.available == 0) this.config.browserFullCount++
if(this.config.browserFullCount > 100) {
this.pool.clear()
this.config.browserFullCount = 0
reject(new Error('browser full count more than 100 times'))
}else {
resolve(driver)
}
})
})
}