diff --git a/main.py b/main.py index c662343..3ee555c 100644 --- a/main.py +++ b/main.py @@ -65,7 +65,7 @@ redis_client = redis.Redis(host="localhost", port=6379, db=0) influx_url = influxdb_info.url influx_token = influxdb_info.token influx_org_name = influxdb_info.org -influx_client = InfluxDBClient(url=influx_url, token=influx_token, org=influx_org_name, timeout=10000*1000) # 100 seconds +influx_client = InfluxDBClient(url=influx_url, token=influx_token, org=influx_org_name, timeout=100*1000) # 100 seconds # 配置日志记录器 logging.basicConfig( @@ -2125,14 +2125,14 @@ async def query_scada_latest_record_by_id(id: str): # def query_all_record_by_time(query_time: str, bucket: str="realtime_data", client: InfluxDBClient=client) -> tuple: @app.get("/queryallrecordsbytime/") -async def query_all_records_by_time(querytime: str) -> dict[str, list]: +async def fastapi_query_all_records_by_time(querytime: str) -> dict[str, list]: results: tuple = influxdb_api.query_all_record_by_time(query_time=querytime, client=influx_client) return { "nodes": results[0], "links": results[1] } #def query_all_record_by_date(query_date: str, bucket: str="realtime_simulation_result", client: InfluxDBClient=client) -> tuple: @app.get("/queryallrecordsbydate/") -async def query_all_records_by_time(querydate: str) -> dict[str, list]: +async def fastapi_query_all_records_by_date(querydate: str) -> dict[str, list]: results: tuple = influxdb_api.query_all_record_by_date(query_date=querydate, client=influx_client) return { "nodes": results[0], "links": results[1] }