Make bridge notification less spammy
This commit is contained in:
		
							parent
							
								
									250099f5fd
								
							
						
					
					
						commit
						4ab59d522d
					
				| 
						 | 
					@ -76,7 +76,8 @@ async def game_watcher(ctx: FactorioContext):
 | 
				
			||||||
    researches_done_file = os.path.join(script_folder, "research_done.json")
 | 
					    researches_done_file = os.path.join(script_folder, "research_done.json")
 | 
				
			||||||
    if os.path.exists(researches_done_file):
 | 
					    if os.path.exists(researches_done_file):
 | 
				
			||||||
        os.remove(researches_done_file)
 | 
					        os.remove(researches_done_file)
 | 
				
			||||||
    from worlds.factorio.Technologies import lookup_id_to_name, tech_table
 | 
					    from worlds.factorio.Technologies import lookup_id_to_name
 | 
				
			||||||
 | 
					    bridge_counter = 0
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        while 1:
 | 
					        while 1:
 | 
				
			||||||
            if os.path.exists(researches_done_file):
 | 
					            if os.path.exists(researches_done_file):
 | 
				
			||||||
| 
						 | 
					@ -92,8 +93,11 @@ async def game_watcher(ctx: FactorioContext):
 | 
				
			||||||
                        await ctx.send_msgs([{"cmd": 'LocationChecks', "locations": tuple(research_data)}])
 | 
					                        await ctx.send_msgs([{"cmd": 'LocationChecks', "locations": tuple(research_data)}])
 | 
				
			||||||
                    await asyncio.sleep(1)
 | 
					                    await asyncio.sleep(1)
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                research_logger.info("Did not find Factorio Bridge file.")
 | 
					                bridge_counter += 1
 | 
				
			||||||
                await asyncio.sleep(5)
 | 
					                if bridge_counter >= 60:
 | 
				
			||||||
 | 
					                    research_logger.info("Did not find Factorio Bridge file, waiting for mod to run.")
 | 
				
			||||||
 | 
					                    bridge_counter = 1
 | 
				
			||||||
 | 
					                await asyncio.sleep(1)
 | 
				
			||||||
    except Exception as e:
 | 
					    except Exception as e:
 | 
				
			||||||
        logging.exception(e)
 | 
					        logging.exception(e)
 | 
				
			||||||
        logging.error("Aborted Factorio Server Bridge")
 | 
					        logging.error("Aborted Factorio Server Bridge")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue