From 382bcf36c97354bc84c10f71a262f58e13a5b84d Mon Sep 17 00:00:00 2001 From: sf-v Date: Thu, 14 Apr 2022 11:16:42 -0700 Subject: [PATCH] fix: set the correct state for the agent when a client disconnects Before this change, when a client disconnected, the state of the agent would remain busy even though the agent would be idle, making everything hang indefinitely. --- packages/@best/agent/src/agent.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/@best/agent/src/agent.ts b/packages/@best/agent/src/agent.ts index ed46d19b..7606f873 100644 --- a/packages/@best/agent/src/agent.ts +++ b/packages/@best/agent/src/agent.ts @@ -174,6 +174,13 @@ export class Agent extends EventEmitter { this.interruption.requestInterruption(); } } + + /* + * Once the disconnect happens, the agent is now able to + * take on new tasks, hence, mark its state as "idle". + */ + + this.state = AgentState.IDLE; }); // Forward events from the Client to the Agent