当前位置: 首页>>代码示例>>Python>>正文


Python QueryHelper.get_terminals_by_group_id方法代码示例

本文整理汇总了Python中helpers.queryhelper.QueryHelper.get_terminals_by_group_id方法的典型用法代码示例。如果您正苦于以下问题:Python QueryHelper.get_terminals_by_group_id方法的具体用法?Python QueryHelper.get_terminals_by_group_id怎么用?Python QueryHelper.get_terminals_by_group_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在helpers.queryhelper.QueryHelper的用法示例。


在下文中一共展示了QueryHelper.get_terminals_by_group_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _on_finish

# 需要导入模块: from helpers.queryhelper import QueryHelper [as 别名]
# 或者: from helpers.queryhelper.QueryHelper import get_terminals_by_group_id [as 别名]

#.........这里部分代码省略.........
                    )

                res = DotDict(
                    name=corp_info["name"],
                    cid=corp_info["cid"],
                    online=0,
                    offline=0,
                    groups=[],
                    lastinfo_time=current_time,
                )

                group_info_key = get_group_info_key(uid)
                group_info_tuple = self.redis.getvalue(group_info_key)
                if group_info_tuple:
                    group_info_old, group_info_time = group_info_tuple
                else:
                    group_info_old, group_info_time = None, None
                if group_info_old is not None:
                    if group_info_old != groups:
                        # logging.info("[UWEB] res_type=2, group_info changed, cid:%s", self.current_user.cid)
                        res_type = 2
                        self.redis.setvalue(group_info_key, (groups, current_time))
                    else:
                        if lastinfo_time < group_info_time:
                            # logging.info("[UWEB] res_type=2, group_info time changed, lastinfo_time:%s < group_info_time:%s, cid:%s",
                            # lastinfo_time, group_info_time,
                            # self.current_user.cid)
                            res_type = 2
                else:
                    self.redis.setvalue(group_info_key, (groups, current_time))

                for group in groups:
                    group["trackers"] = {}
                    terminals = QueryHelper.get_terminals_by_group_id(group.gid, db)
                    tids = [str(terminal.tid) for terminal in terminals]
                    _now_time = time.time()
                    if (_now_time - _start_time) > 5:
                        logging.info(
                            "[UWEB] Inclastinfo step1_group_sql used time: %s > 5s, cid: %s, gid: %s",
                            _now_time - _start_time,
                            self.current_user.cid,
                            group.gid,
                        )

                    terminal_info_key = get_group_terminal_info_key(uid, group.gid)
                    terminal_info_tuple = self.redis.getvalue(terminal_info_key)
                    if terminal_info_tuple:
                        terminal_info_old, terminal_info_time = terminal_info_tuple
                    else:
                        terminal_info_old, terminal_info_time = None, None
                    if terminal_info_old is not None:
                        if terminal_info_old != tids:
                            # logging.info("[UWEB] res_type=2, terminal_info changed, cid:%s", self.current_user.cid)
                            res_type = 2
                            self.redis.setvalue(terminal_info_key, (tids, current_time))
                        else:
                            if lastinfo_time < terminal_info_time:
                                # logging.info("[UWEB] res_type=2, terminal_info time changed, lastinfo_time:%s < terminal_info_time:%s, cid:%s",
                                # lastinfo_time, terminal_info_time,
                                # self.current_user.cid)
                                res_type = 2
                    else:
                        self.redis.setvalue(terminal_info_key, (tids, current_time))
                    _now_time = time.time()
                    if (_now_time - _start_time) > 5:
                        logging.info(
开发者ID:jcsy521,项目名称:ydws,代码行数:70,代码来源:inclastinfo.py


注:本文中的helpers.queryhelper.QueryHelper.get_terminals_by_group_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。