mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-24 08:55:23 +02:00
check idle before resuming
This commit is contained in:
parent
5a27e005c7
commit
d968f8d5b9
1 changed files with 2 additions and 5 deletions
|
@ -13,9 +13,6 @@ export class Coder {
|
|||
this.generating = false;
|
||||
this.code_template = '';
|
||||
this.timedout = false;
|
||||
this.resume_func = null;
|
||||
this.resume_name = null;
|
||||
this.interruptible = false;
|
||||
}
|
||||
|
||||
async load() {
|
||||
|
@ -166,9 +163,9 @@ export class Coder {
|
|||
this.resume_func = func;
|
||||
this.resume_name = name;
|
||||
}
|
||||
if (this.resume_func != null) {
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
if (this.resume_func != null && this.agent.isIdle()) {
|
||||
this.interruptible = true;
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
let res = await this.execute(this.resume_func, timeout);
|
||||
this.interruptible = false;
|
||||
return res;
|
||||
|
|
Loading…
Add table
Reference in a new issue