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()
@ -43,6 +43,7 @@ async def getData(coopId, geocode):
await f.close()
async def makeRecord():
loop = asyncio.get_running_loop()
l.info("Writing AchesAndPains record.")
header = '<Data type="AchesAndPains">'
@ -73,7 +74,7 @@ async def makeRecord():
file = "./.temp/AchesAndPains.gz"
command = '<MSG><Exec workRequest="storeData(File={0},QGROUP=__AchesAndPains__,Feed=AchesAndPains)" /><GzipCompressedMsg fname="AchesAndPains" /></MSG>'
bit.sendFile([file], [command], 1, 0)
await loop.run_in_executor(bit.sendFile([file], [command], 1, 0))
remove('./.temp/AchesAndPains.i2m')
remove('./.temp/AchesAndPains.gz')