elif agent.state.status == AssignState.STATUS_IN_TASK:
self._handle_worker_disconnect(worker_id, assignment_id)
agent.disconnected = True
elif agent.state.status == AssignState.STATUS_DONE:
// It"s okay if a complete assignment socket dies, but wait for the
// world to clean up the resource
return
elif agent.state.status == AssignState.STATUS_ASSIGNED:
// mark the agent in the assigned state as disconnected, the task
// spawn thread is responsible for cleanup
agent.state.status = AssignState.STATUS_DISCONNECT
agent.disconnected = True
self.socket_manager.close_channel(agent.get_connection_id())
After Change
elif agent.get_status() == AssignState.STATUS_ONBOARDING:
// Agent never made it to task pool, the onboarding thread will die
// and delete the agent if we mark it as a disconnect
agent.set_status(AssignState.STATUS_DISCONNECT)
agent.reduce_state()
agent.disconnected = True
elif agent.get_status() == AssignState.STATUS_WAITING:
// agent is in pool, remove from pool and delete