mirror of
https://github.com/mewtek/i2ME-Legacy.git
synced 2025-05-14 18:21:05 -05:00
re-enable radarCollector task
This commit is contained in:
parent
6f297ebdd7
commit
10f328fec3
19
main.py
19
main.py
@ -10,7 +10,7 @@ from datetime import datetime
|
|||||||
l = logging.getLogger(__name__)
|
l = logging.getLogger(__name__)
|
||||||
coloredlogs.install(logger=l)
|
coloredlogs.install(logger=l)
|
||||||
|
|
||||||
radarTypes = ['radarmosaic', 'satrad']
|
useRadarServer = True
|
||||||
|
|
||||||
# Create dirs and files
|
# Create dirs and files
|
||||||
if not os.path.exists('.temp/'):
|
if not os.path.exists('.temp/'):
|
||||||
@ -64,13 +64,17 @@ async def HourUpdaters():
|
|||||||
await asyncio.sleep(60 * 60)
|
await asyncio.sleep(60 * 60)
|
||||||
|
|
||||||
async def radarCollector():
|
async def radarCollector():
|
||||||
radarUpdateIntervalMinutes = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
|
mosaicUpdateIntervals = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]
|
||||||
|
satradUpdateIntervals = [0, 10, 20, 30, 40, 50]
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# Server takes ~15 - 35 seconds on average to fully generate a frame, use 40 seconds
|
# Server takes ~15 - 35 seconds on average to fully generate a frame, use 40 seconds
|
||||||
# to make sure the radar frame is fully good to go
|
# to make sure the radar frame is fully good to go
|
||||||
if datetime.now().minute in radarUpdateIntervalMinutes and datetime.now().second == 40:
|
if datetime.now().minute in mosaicUpdateIntervals and datetime.now().second == 40:
|
||||||
for type in radarTypes:
|
await TWCRadarCollector.collect("radarmosaic")
|
||||||
await TWCRadarCollector.collect(type)
|
|
||||||
|
if datetime.now().minute in satradUpdateIntervals and datetime.now().second == 45:
|
||||||
|
await TWCRadarCollector.collect("satrad")
|
||||||
|
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
@ -78,11 +82,12 @@ loop = asyncio.get_event_loop()
|
|||||||
alertTask = loop.create_task(grabAlertsLoop())
|
alertTask = loop.create_task(grabAlertsLoop())
|
||||||
CCtask = loop.create_task(FiveMinUpdaters())
|
CCtask = loop.create_task(FiveMinUpdaters())
|
||||||
ForecastsTask = loop.create_task(HourUpdaters())
|
ForecastsTask = loop.create_task(HourUpdaters())
|
||||||
# radarTask = loop.create_task(radarCollector())
|
|
||||||
|
if useRadarServer: radarTask = loop.create_task(radarCollector())
|
||||||
|
|
||||||
try:
|
try:
|
||||||
loop.run_until_complete(alertTask)
|
loop.run_until_complete(alertTask)
|
||||||
loop.run_until_complete(CCtask)
|
loop.run_until_complete(CCtask)
|
||||||
loop.run_until_complete(ForecastsTask)
|
loop.run_until_complete(ForecastsTask)
|
||||||
# loop.run_until_complete(radarTask)
|
if useRadarServer: loop.run_until_complete(radarTask)
|
||||||
except asyncio.CancelledError: pass
|
except asyncio.CancelledError: pass
|
Loading…
x
Reference in New Issue
Block a user