Files
FastAPI_async/internal_loop.py
2025-09-25 10:40:29 +02:00

20 lines
576 B
Python

import asyncio
from influxdb_client.client.influxdb_client_async import InfluxDBClientAsync
from config import INFLUX_BUCKET, INFLUX_ORG
from influx_related import get_influx_data
async def internal_loop(influxdb_client: InfluxDBClientAsync):
i = 0
while True:
print("internal_loop", i)
i += 1
try:
records = await get_influx_data(influxdb_client)
print("influx records:", len(records))
[print(" -", i) for i in records]
except Exception as e:
print(e)
await asyncio.sleep(5)