mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-06-10 05:30:00 -05:00
Prevent blocking when sending files to the i2
This commit is contained in:
@ -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')
|
Reference in New Issue
Block a user