修复 puppeteer.js 中的一些小问题
* 修改 screenshots 中的渲染模板错误 * this.browserMacKey 仅在 process.env.pm_id 存在时被设置
This commit is contained in:
parent
2e3a9f4987
commit
d9a8b97955
|
@ -130,7 +130,7 @@ class Puppeteer {
|
||||||
logger.mark('puppeteer Chromium 已连接启动的实例')
|
logger.mark('puppeteer Chromium 已连接启动的实例')
|
||||||
} else {
|
} else {
|
||||||
console.log('chromium', this.browser.wsEndpoint())
|
console.log('chromium', this.browser.wsEndpoint())
|
||||||
if (this.browserMacKey) {
|
if (process.env.pm_id && this.browserMacKey) {
|
||||||
//缓存一下实例30天
|
//缓存一下实例30天
|
||||||
const expireTime = 60 * 60 * 24 * 30
|
const expireTime = 60 * 60 * 24 * 30
|
||||||
await redis.set(this.browserMacKey, this.browser.wsEndpoint(), { EX: expireTime })
|
await redis.set(this.browserMacKey, this.browser.wsEndpoint(), { EX: expireTime })
|
||||||
|
@ -257,7 +257,7 @@ class Puppeteer {
|
||||||
|
|
||||||
if (!this.browser) return false
|
if (!this.browser) return false
|
||||||
|
|
||||||
const savePath = this.dealTpl(this.model, data)
|
const savePath = this.dealTpl(name, data)
|
||||||
if (!savePath) return false
|
if (!savePath) return false
|
||||||
|
|
||||||
const page = await this.browser.newPage()
|
const page = await this.browser.newPage()
|
||||||
|
|
Loading…
Reference in New Issue