diff --git a/PriceSystem/CalcCmdReceiver.py b/PriceSystem/CalcCmdReceiver.py index 59761c9..0e068a7 100644 --- a/PriceSystem/CalcCmdReceiver.py +++ b/PriceSystem/CalcCmdReceiver.py @@ -21,7 +21,6 @@ def worker(): cmd = client.lpop(QUEUE) except Exception as ex: cmd = None - print(ex) if cmd is None: time.sleep(60) logger.info("等待接受计算命令") @@ -32,11 +31,10 @@ def worker(): sell_price.calc_sell_price(cmd) end_time = time.time() logger.info("Calc SUC:" + str(cmd) + "\t计算成功,耗时:" + str(end_time - start_time)) - except Exception as ex: - print(ex) + except BaseException as ex: logger.exception(ex) end_time = time.time() - logger.error("Calc ERROR :" + str(cmd) + "\t计算失败,耗时:" + (end_time - start_time)) + logger.error("Calc ERROR :" + str(cmd) + "\t计算失败,耗时:" + str(end_time - start_time)) def format_cmd(cmd): @@ -53,7 +51,6 @@ if __name__ == "__main__": if os.path.exists(lock_file): os.remove(lock_file) pro_num = config.get_worker_num() - #pro_num = 1 pool = multiprocessing.Pool(processes=pro_num) for pid in range(0, pro_num): pool.apply_async(worker, ()) diff --git a/PriceSystem/config/__init__.py b/PriceSystem/config/__init__.py index 29331ed..adae809 100644 --- a/PriceSystem/config/__init__.py +++ b/PriceSystem/config/__init__.py @@ -1,4 +1,8 @@ def get_worker_num(): + """ + 获取进行均价计算的进程数 + :return: + """ return 20