Prevent blocking when sending files to the i2

This commit is contained in:
April
2022-11-13 17:08:26 -07:00
parent 7727cdc23d
commit 2936a64cff
14 changed files with 40 additions and 27 deletions

View File

@ -7,7 +7,7 @@ import records.LFRecord as LFR
import gzip
from os import remove
import xml.dom.minidom
import aiohttp, aiofiles
import aiohttp, aiofiles, asyncio
l = logging.getLogger(__name__)
coloredlogs.install()
@ -42,6 +42,7 @@ async def getData(coopId, geocode):
await f.close()
async def makeRecord():
loop = asyncio.get_running_loop()
l.info("Writing WateringNeeds record.")
header = '<Data type="WateringNeeds">'
@ -72,7 +73,7 @@ async def makeRecord():
file = "./.temp/WateringNeeds.gz"
command = '<MSG><Exec workRequest="storeData(File={0},QGROUP=__WateringNeeds__,Feed=WateringNeeds)" /><GzipCompressedMsg fname="WateringNeeds" /></MSG>'
bit.sendFile([file], [command], 1, 0)
await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/WateringNeeds.i2m')
remove('./.temp/WateringNeeds.gz')