mirror of
https://github.com/getmaxun/maxun.git
synced 2026-10-16 20:21:03 +08:00
fix(maxun-core): check active execution before resetting isAborted
Move this.stopper guard to top of run() before resetting isAborted. This ensures an in-flight execution's abort flag cannot be accidentally cleared if run() is invoked while the interpreter is already active.
This commit is contained in:
@@ -3222,8 +3222,11 @@ export default class Interpreter extends EventEmitter {
|
||||
* for the `{$param: nameofparam}` fields.
|
||||
*/
|
||||
public async run(page: Page, params?: ParamType): Promise<void> {
|
||||
this.log('Starting the workflow.', Level.LOG);
|
||||
if (this.stopper) {
|
||||
throw new Error('This Interpreter is already running a workflow. To run another workflow, please, spawn another Interpreter.');
|
||||
}
|
||||
this.isAborted = false;
|
||||
this.log('Starting the workflow.', Level.LOG);
|
||||
const context = page.context();
|
||||
|
||||
page.setDefaultNavigationTimeout(100000);
|
||||
@@ -3239,9 +3242,6 @@ export default class Interpreter extends EventEmitter {
|
||||
this.log(`Proxy authenticated...`);
|
||||
}
|
||||
}
|
||||
if (this.stopper) {
|
||||
throw new Error('This Interpreter is already running a workflow. To run another workflow, please, spawn another Interpreter.');
|
||||
}
|
||||
/**
|
||||
* `this.workflow` with the parameters initialized.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user