release lock on boot
This commit is contained in:
		
							
								
								
									
										2
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.py
									
									
									
									
									
								
							@@ -24,6 +24,7 @@ dp = Dispatcher(bot)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def check_updates():
 | 
					async def check_updates():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async with redis.lock('e621:update'):
 | 
					    async with redis.lock('e621:update'):
 | 
				
			||||||
        tag_list = [t.decode() for t in await redis.smembers('e621:subs')]
 | 
					        tag_list = [t.decode() for t in await redis.smembers('e621:subs')]
 | 
				
			||||||
        tag_list.sort()
 | 
					        tag_list.sort()
 | 
				
			||||||
@@ -130,6 +131,7 @@ async def update(msg: Message):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def background_on_start():
 | 
					async def background_on_start():
 | 
				
			||||||
 | 
					    await redis.lock('e621:update').release()
 | 
				
			||||||
    while True:
 | 
					    while True:
 | 
				
			||||||
        await check_updates()
 | 
					        await check_updates()
 | 
				
			||||||
        await asyncio.sleep(60)
 | 
					        await asyncio.sleep(60)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user