diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index 481b8e0c..f46f0119 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -53,6 +53,10 @@ def db_insert_mplogx(): last_tag_id = config['enm'].get('last_tag_id', None) if last_tag_id is None: raise Exception("last_tag_id is None") + cursor.execute("select count(id) from tag_value where id > %s", (last_tag_id)) + count = cursor.fetchone()[0] + if count > 400: + raise Exception("db inset count > 400") cursor.execute( "select id, val, tag_code, update_time from tag_value where id > %s order by id, update_time", (last_tag_id)) rows = cursor.fetchall() # 获取数据后保存至本地