From e4aa0f20b8bee4ebdb62f8666f3c2694c530a26b Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sun, 13 Apr 2025 17:40:58 +0800 Subject: [PATCH 1/2] Enable gzip for influxdb client --- influxdb_api.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/influxdb_api.py b/influxdb_api.py index 0ca239b..aa76ee3 100644 --- a/influxdb_api.py +++ b/influxdb_api.py @@ -171,7 +171,11 @@ def query_pg_scada_info_non_realtime(name: str) -> None: # 2025/03/23 def get_new_client() -> InfluxDBClient: """每次调用返回一个新的 InfluxDBClient 实例。""" - return InfluxDBClient(url=url, token=token, org=org_name, timeout=600*1000) # 600 seconds + return InfluxDBClient(url=url, + token=token, + org=org_name, + enable_gzip=True, + timeout=600*1000) # 600 seconds # 2025/04/11, DingZQ def create_write_options() -> WriteOptions: @@ -3115,11 +3119,11 @@ if __name__ == "__main__": client = InfluxDBClient(url=url, token=token) # step1: 检查连接状态,初始化influxdb的buckets - # try: - # # delete_buckets(org_name) - # create_and_initialize_buckets(org_name) - # except Exception as e: - # print(f"连接失败: {e}") + try: + # delete_buckets(org_name) + create_and_initialize_buckets(org_name) + except Exception as e: + print(f"连接失败: {e}") # step2: 先查询pg数据库中scada_info的信息,然后存储SCADA数据到SCADA_data这个bucket里 From 14477b6224c4534eb926c1ff6a4f0a0243d62592 Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sun, 13 Apr 2025 17:42:08 +0800 Subject: [PATCH 2/2] pull source code when start fastapi --- startfastapiserver.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/startfastapiserver.bat b/startfastapiserver.bat index 07438d6..468c0b1 100644 --- a/startfastapiserver.bat +++ b/startfastapiserver.bat @@ -1,6 +1,8 @@ REM f: REM cd "f:\DEV\GitHub\TJWaterServer" +git pull + REM call startpg.bat cd C:\SourceCode\Server REM uvicorn main:app --host 0.0.0.0 --port 80 --reload