Administrator
2023-08-03 4d321ae069fce2c0f6f7884bec8fa6c4ec534d1a
ths/l2_code_operate.py
@@ -110,7 +110,7 @@
        while True:
            cls.set_read_queue_valid()
            try:
                data =RedisUtils.lpop(redis,"code_operate_queue")
                data = RedisUtils.lpop(redis, "code_operate_queue", auto_free= False)
                # print("读取操作队列", data, redis.llen("code_operate_queue"))
                if data is not None:
                    data = json.loads(data)
@@ -186,8 +186,7 @@
        # 09:25:10之后才能操作
        if int(tool.get_now_time_str().replace(":", "")) < int("092510"):
            return
        redis = self.redis_manager_.getRedis()
        RedisUtils.rpush(redis, "code_operate_queue",
        RedisUtils.rpush(self.redis_manager_.getRedis(), "code_operate_queue",
                    json.dumps({"type": type, "msg": msg, "code": code, "client": client, "pos": pos,
                                "create_time": round(time.time() * 1000)}))
@@ -210,8 +209,7 @@
            data = {"action": "repairL2Data",
                    "data": {"index": int(pos), "code": code, "min_price": float(min_price),
                             "max_price": float(max_price)}}
            redis = self.redis_manager_.getRedis()
            RedisUtils.rpush(redis, "code_operate_queue", json.dumps(
            RedisUtils.rpush(self.redis_manager_.getRedis(), "code_operate_queue", json.dumps(
                {"type": 3, "code": code, "client": client_id, "data": data, "create_time": round(time.time() * 1000)}))
    # 移除监控
@@ -234,13 +232,11 @@
    # 设置读取队列有效
    @classmethod
    def set_read_queue_valid(cls):
        redis = cls.getRedis()
        RedisUtils.setex( redis,"operate_queue_read_state", 20, 1)
        RedisUtils.setex(cls.getRedis(), "operate_queue_read_state", 20, 1)
    @classmethod
    def is_read_queue_valid(cls):
        redis = cls.getRedis()
        return RedisUtils.get(redis, "operate_queue_read_state") is not None
        return RedisUtils.get(cls.getRedis(), "operate_queue_read_state") is not None
# 通过l2代码校验代码位