!14 修复 puppeteer.js 中的一些小问题

Merge pull request !14 from ikuaki1009/N/A
This commit is contained in:
Yoimiya 2023-04-10 15:19:03 +00:00 committed by Gitee
commit 4a79c329bf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 2 deletions

View File

@ -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()