forked from M-Labs/artiq
artiq_influxdb: use aiohttp.ClientSession. Closes #829
This commit is contained in:
parent
26fdd42f8f
commit
29181b1586
|
@ -94,6 +94,7 @@ class DBWriter(TaskObject):
|
||||||
"too many pending updates", k)
|
"too many pending updates", k)
|
||||||
|
|
||||||
async def _do(self):
|
async def _do(self):
|
||||||
|
async with aiohttp.ClientSession() as session:
|
||||||
while True:
|
while True:
|
||||||
k, v, t = await self._queue.get()
|
k, v, t = await self._queue.get()
|
||||||
url = self.base_url + "/write"
|
url = self.base_url + "/write"
|
||||||
|
@ -102,8 +103,7 @@ class DBWriter(TaskObject):
|
||||||
data = "{},dataset={} {} {}".format(
|
data = "{},dataset={} {} {}".format(
|
||||||
self.table, k, format_influxdb(v), round(t*1e3))
|
self.table, k, format_influxdb(v), round(t*1e3))
|
||||||
try:
|
try:
|
||||||
response = await aiohttp.request(
|
response = await session.post(url, params=params, data=data)
|
||||||
"POST", url, params=params, data=data)
|
|
||||||
except:
|
except:
|
||||||
logger.warning("got exception trying to update '%s'",
|
logger.warning("got exception trying to update '%s'",
|
||||||
k, exc_info=True)
|
k, exc_info=True)
|
||||||
|
|
Loading…
Reference in New Issue