Skip to content

Commit

Permalink
fix: set the correct state for the agent when a client disconnects
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sf-v committed Apr 14, 2022
1 parent fb6f9ff commit 382bcf3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/@best/agent/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 382bcf3

Please sign in to comment.