Administrator
2023-09-14 29778778a3b21d77b95ccfe92367d077180e40a3
线程ID记录
7个文件已修改
22 ■■■■■ 已修改文件
db/redis_manager_delegate.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/l2_client.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/trade_client.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/trade_api_server.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
trade/huaxin/trade_server.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/tool.py 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/redis_manager_delegate.py
@@ -196,6 +196,7 @@
    @classmethod
    def run_loop(cls):
        logger_system.info("启动Redis数据同步服务")
        logger_system.info(f"redis 线程ID:{tool.get_thread_id()}")
        dataList = []
        last_upload_time = time.time()
        while True:
huaxin_client/l2_client.py
@@ -14,6 +14,7 @@
from log_module import log, async_log_util
from log_module.log import logger_local_huaxin_l2_subscript, logger_system, logger_local_huaxin_l2_transaction, \
    logger_local_huaxin_g_cancel, logger_l2_codes_subscript
from utils import tool
Front_Address = "tcp://10.0.1.101:6900"
Multicast_Address = "udp://224.224.2.19:7889"
@@ -578,6 +579,7 @@
def run(pipe_trade, _pipe_strategy, _l2_data_callback: l2_data_transform_protocol.L2DataCallBack)->None:
    logger_system.info("L2进程ID:{}", os.getpid())
    logger_system.info(f"l2_client 线程ID:{tool.get_thread_id()}")
    try:
        log.close_print()
        if pipe_trade is not None:
huaxin_client/trade_client.py
@@ -17,6 +17,7 @@
from huaxin_client.trade_transform_protocol import TradeRequest, TradeResponse
from log_module import async_log_util
from log_module.log import logger_local_huaxin_trade_debug, logger_system, logger_trade
from utils import tool
UserID = '388000013349'
# 登陆密码
@@ -1083,6 +1084,7 @@
def run(trade_response_: TradeResponse, pipe_l2=None, pipe_strategy=None):
    try:
        logger_system.info("交易进程ID:{}", os.getpid())
        logger_system.info(f"trade 线程ID:{tool.get_thread_id()}")
        __init_trade_data_server()
        global l2pipe
        l2pipe = pipe_l2
main.py
@@ -71,6 +71,7 @@
def createDataServer():
    logger_system.info("create DataServer")
    logger_system.info(f"createDataServer 线程ID:{tool.get_thread_id()}")
    tcpserver = data_server.run("", 9004)
    tcpserver.serve_forever()
    try:
trade/huaxin/trade_api_server.py
@@ -501,6 +501,7 @@
def run(pipe_server, pipe_l2):
    logger_system.info("create TradeApiServer")
    logger_system.info(f"trade_api_server 线程ID:{tool.get_thread_id()}")
    # 拉取交易信息
    huaxin_trade_data_update.run()
    #
trade/huaxin/trade_server.py
@@ -815,6 +815,7 @@
def run(pipe_trade, pipe_l1, pipe_l2, trade_cmd_callback):
    logger_system.info(f"trade_server 线程ID:{tool.get_thread_id()}")
    try:
        # 执行一些初始化数据
        block_info.init()
utils/tool.py
@@ -1,8 +1,10 @@
"""
常用工具
"""
import ctypes
import decimal
import random
import threading
import time
import time as t
import datetime
@@ -234,3 +236,15 @@
        if code in cache_dict:
            return True, cache_dict.get(code)
        return False, None
def get_thread_id():
    try:
        if constant.is_windows():
            return threading.current_thread().ident
        else:
            thread_id = ctypes.CDLL('libc.so.6').syscall(186)  # Linux下的系统调用号
            return thread_id
    except:
        pass
    return None