|
@@ -553,10 +553,18 @@ class AgentStateService:
|
|
|
if len(idle_agents) <= 0:
|
|
|
return choose_phone_num
|
|
|
choose_phone_num = self._choose_max_idle_time(idle_agents)
|
|
|
+ self.handle_assign_time(saas_id, service_id, choose_phone_num)
|
|
|
return choose_phone_num
|
|
|
|
|
|
def handle_assign_time(self, saas_id, service_id, choose_phone_num):
|
|
|
key = self._key(saas_id, service_id)
|
|
|
+ cache_agent_map = self.get_cache_agent_map(saas_id, service_id)
|
|
|
+ if cache_agent_map and choose_phone_num in cache_agent_map:
|
|
|
+ state_data = cache_agent_map[choose_phone_num]
|
|
|
+ state_data.assign_time = datetime.utcnow().timestamp() * 1000
|
|
|
+ self.redis_handler.redis.hset(key, choose_phone_num, state_data.to_json_string())
|
|
|
+ self.redis_handler.redis.expire(key, self._get_expire_time())
|
|
|
+ # self.update_report_state(saas_id, service_id)
|
|
|
|
|
|
|
|
|
def idle_agents(self, saas_id, service_id):
|