mirror of
https://github.com/PaiGramTeam/MibooGram.git
synced 2024-11-25 18:04:00 +00:00
✨ Flush Cookies Cache on Initialization
This commit is contained in:
parent
611ad8dd4e
commit
393ab40459
@ -1,3 +1,4 @@
|
|||||||
|
import asyncio
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from telegram.ext import CallbackContext
|
from telegram.ext import CallbackContext
|
||||||
@ -11,8 +12,16 @@ class PublicCookies(Plugin):
|
|||||||
def __init__(self, public_cookies_service: PublicCookiesService = None):
|
def __init__(self, public_cookies_service: PublicCookiesService = None):
|
||||||
self.public_cookies_service = public_cookies_service
|
self.public_cookies_service = public_cookies_service
|
||||||
|
|
||||||
|
async def __async_init__(self):
|
||||||
|
async def _refresh():
|
||||||
|
logger.info("正在刷新公共Cookies池")
|
||||||
|
await self.public_cookies_service.refresh()
|
||||||
|
logger.success("刷新公共Cookies池成功")
|
||||||
|
|
||||||
|
asyncio.create_task(_refresh())
|
||||||
|
|
||||||
@job.run_repeating(interval=datetime.timedelta(hours=2), name="PublicCookiesRefresh")
|
@job.run_repeating(interval=datetime.timedelta(hours=2), name="PublicCookiesRefresh")
|
||||||
async def refresh(self, _: CallbackContext):
|
async def refresh(self, _: CallbackContext):
|
||||||
logger.info("正在刷新公共Cookies池")
|
logger.info("正在刷新公共Cookies池")
|
||||||
await self.public_cookies_service.refresh()
|
await self.public_cookies_service.refresh()
|
||||||
logger.info("刷新公共Cookies池成功")
|
logger.success("刷新公共Cookies池成功")
|
||||||
|
Loading…
Reference in New Issue
Block a user