|
@@ -78,9 +78,7 @@ class InboundClient:
|
|
|
time.sleep(3)
|
|
|
self.start()
|
|
|
else:
|
|
|
- threading.Thread(target=self.process_esl_event, args=(e, )).start()
|
|
|
- # TODO thread pool is shutdown, waiting fix
|
|
|
- #threading.Thread(target=self.submit_thread_pool_executor, args=(e, )).start()
|
|
|
+ self.choose_thread_pool_executor(e).submit(self.process_esl_event, e)
|
|
|
|
|
|
def choose_thread_pool_executor(self, e):
|
|
|
call_id = EslEventUtil.getCallId(e)
|
|
@@ -91,15 +89,9 @@ class InboundClient:
|
|
|
random_index = abs(mmh3.hash(random_id)) % len(self.executors)
|
|
|
else:
|
|
|
random_index = random.randint(0, len(self.executors) - 1) if self.executors else 0
|
|
|
+ # print('choose_thread_pool_executor.index=', random_index, call_id, device_id, wdh_device_id)
|
|
|
return self.executors.get(random_index)
|
|
|
|
|
|
- def submit_thread_pool_executor(self, e):
|
|
|
- executor = self.choose_thread_pool_executor(e)
|
|
|
- future = executor.submit(self.process_esl_event, e)
|
|
|
- for future in concurrent.futures.as_completed(future):
|
|
|
- future.result()
|
|
|
- print('complete')
|
|
|
-
|
|
|
def process_esl_event(self, e):
|
|
|
# print(json.loads(e.serialize('json')))
|
|
|
event_name = EslEventUtil.getEventName(e)
|