mirror of
				https://github.com/mewtek/i2ME-Legacy.git
				synced 2025-06-10 05:30:00 -05:00 
			
		
		
		
	Go back to old loop system & take Radar processing out of the loop
This commit is contained in:
		
							
								
								
									
										30
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								main.py
									
									
									
									
									
								
							| @@ -1,7 +1,8 @@ | |||||||
| import asyncio | import asyncio | ||||||
|  | from asyncore import loop | ||||||
| import logging,coloredlogs | import logging,coloredlogs | ||||||
| from recordGenerators import DailyForecast,CurrentObservations,HourlyForecast,AirQuality,AirportDelays,PollenForecast,Breathing,Alerts | from recordGenerators import DailyForecast,CurrentObservations,HourlyForecast,AirQuality,AirportDelays,PollenForecast,Breathing,Alerts | ||||||
| from radar import TWCRadarProcessor, RadarProcessor | # from radar import TWCRadarProcessor, RadarProcessor | ||||||
|  |  | ||||||
|  |  | ||||||
| l = logging.getLogger(__name__) | l = logging.getLogger(__name__) | ||||||
| @@ -21,10 +22,12 @@ async def grabAlertsLoop(): | |||||||
|         Alerts.makeRecord() |         Alerts.makeRecord() | ||||||
|         await asyncio.sleep(60) |         await asyncio.sleep(60) | ||||||
|  |  | ||||||
| async def RadarProcessingLoop(): |  | ||||||
|     while True: | # THIS IS BROKEN AT THE MOMENT -- COME BACK LATER. | ||||||
|         await TWCRadarProcessor.makeRadarImages() | # async def RadarProcessingLoop(): | ||||||
|         await asyncio.sleep(30 * 60) | #     while True: | ||||||
|  | #         await TWCRadarProcessor.makeRadarImages() | ||||||
|  | #         await asyncio.sleep(30 * 60) | ||||||
|  |  | ||||||
| async def FiveMinUpdaters(): | async def FiveMinUpdaters(): | ||||||
|     while True: |     while True: | ||||||
| @@ -43,12 +46,13 @@ async def HourUpdaters(): | |||||||
|         l.debug("Sleeping for an hour...") |         l.debug("Sleeping for an hour...") | ||||||
|         await asyncio.sleep(60 * 60) |         await asyncio.sleep(60 * 60) | ||||||
|  |  | ||||||
| async def main(): | loop = asyncio.get_event_loop() | ||||||
|     # Create loops | alertTask = loop.create_task(grabAlertsLoop()) | ||||||
|     asyncio.create_task(grabAlertsLoop()) | CCtask = loop.create_task(FiveMinUpdaters()) | ||||||
|     asyncio.create_task(FiveMinUpdaters()) | ForecastsTask = loop.create_task(HourUpdaters()) | ||||||
|     asyncio.create_task(HourUpdaters()) |  | ||||||
|     asyncio.create_task(RadarProcessingLoop()) |  | ||||||
|  |  | ||||||
| if __name__ == "__main__": | try: | ||||||
|     asyncio.run(main()) |     loop.run_until_complete(alertTask) | ||||||
|  |     loop.run_until_complete(CCtask) | ||||||
|  |     loop.run_until_complete(ForecastsTask) | ||||||
|  | except asyncio.CancelledError: pass | ||||||
		Reference in New Issue
	
	Block a user