feat(forefront): add sleep
このコミットが含まれているのは:
コミット
ac7b24be8d
|
@ -2,6 +2,7 @@ import puppeteer, {Browser, Page, PuppeteerLaunchOptions} from "puppeteer";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import run from "node:test";
|
import run from "node:test";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
|
import {sleep} from "../utils";
|
||||||
|
|
||||||
const runPath = path.join(__dirname, 'run');
|
const runPath = path.join(__dirname, 'run');
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ export class BrowserPool<T> {
|
||||||
if (options.userDataDir) {
|
if (options.userDataDir) {
|
||||||
fs.rmdirSync(options.userDataDir, {recursive: true});
|
fs.rmdirSync(options.userDataDir, {recursive: true});
|
||||||
}
|
}
|
||||||
|
await sleep(5000);
|
||||||
return this.initOne(newID);
|
return this.initOne(newID);
|
||||||
}
|
}
|
||||||
return [page, data, newID];
|
return [page, data, newID];
|
||||||
|
|
|
@ -51,3 +51,9 @@ export function encryptWithAes256Cbc(data: string, key: string): string {
|
||||||
|
|
||||||
return iv.toString('hex') + encryptedData;
|
return iv.toString('hex') + encryptedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function sleep(duration: number): Promise<void> {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => resolve(), duration);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
読み込み中…
新しいイシューから参照