From d31cf4d143a934154063c273f49760dda007636a Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 16 Jul 2024 14:50:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BB=8E=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=BD=AC=E5=AD=98=E5=88=B0=E8=B6=85=E8=A1=A8=E5=81=9Acount?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 4 ++++ 1 file changed, 4 insertions(+) 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() # 获取数据后保存至本地