From b922d70a87167174d438ab01e2ac15c48b5ea9dd Mon Sep 17 00:00:00 2001 From: BreakWa11 Date: Sun, 24 Jul 2016 17:39:16 +0800 Subject: [PATCH] set pull flag --- db_transfer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db_transfer.py b/db_transfer.py index 5749e3e..a234ce6 100644 --- a/db_transfer.py +++ b/db_transfer.py @@ -23,11 +23,14 @@ class TransferBase(object): self.user_pass = {} self.port_uid_table = {} self.onlineuser_cache = lru_cache.LRUCache(timeout=60*30) + self.pull_ok = False def load_cfg(self): pass def push_db_all_user(self): + if self.pull_ok is False: + return #更新用户流量到数据库 last_transfer = self.last_update_transfer curr_transfer = ServerPool.get_instance().get_servers_transfer() @@ -179,6 +182,8 @@ class TransferBase(object): try: db_instance.push_db_all_user() rows = db_instance.pull_db_all_user() + if rows: + db_instance.pull_ok = True db_instance.del_server_out_of_bound_safe(last_rows, rows) last_rows = rows except Exception as e: