feat: set screenshot queue empty while switch off
This commit is contained in:
@@ -420,16 +420,29 @@ export class RemoteBrowser {
|
|||||||
* If an interpretation was running it will be stopped.
|
* If an interpretation was running it will be stopped.
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
public switchOff = async (): Promise<void> => {
|
public async switchOff(): Promise<void> {
|
||||||
await this.interpreter.stopInterpretation();
|
try {
|
||||||
if (this.browser) {
|
await this.interpreter.stopInterpretation();
|
||||||
await this.stopScreencast();
|
|
||||||
await this.browser.close();
|
if (this.screencastInterval) {
|
||||||
} else {
|
clearInterval(this.screencastInterval);
|
||||||
logger.log('error', 'Browser wasn\'t initialized');
|
}
|
||||||
logger.log('error', 'Switching off the browser failed');
|
|
||||||
|
if (this.client) {
|
||||||
|
await this.stopScreencast();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.browser) {
|
||||||
|
await this.browser.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.screenshotQueue = [];
|
||||||
|
//this.performanceMonitor.reset();
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
logger.error('Error during browser shutdown:', error);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
private async optimizeScreenshot(screenshot: Buffer): Promise<Buffer> {
|
private async optimizeScreenshot(screenshot: Buffer): Promise<Buffer> {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user