/nearby, subscriptions check, geocoding #2

Merged
profitroll merged 30 commits from dev into master 2023-01-02 12:16:38 +02:00
2 changed files with 24 additions and 14 deletions
Showing only changes of commit ace71fd6be - Show all commits

View File

@ -42,6 +42,14 @@
"cache_avatars": { "cache_avatars": {
"interval": 6, "interval": 6,
"enabled": true "enabled": true
},
"cache_members": {
"interval": 30,
"enabled": true
},
"cache_admins": {
"interval": 120,
"enabled": true
} }
}, },
"locations": { "locations": {

View File

@ -12,7 +12,8 @@ from modules.database import col_applications, col_sponsorships
scheduler = AsyncIOScheduler() scheduler = AsyncIOScheduler()
@scheduler.scheduled_job(trigger="interval", seconds=20) if configGet("enabled", "scheduler", "cache_members"):
@scheduler.scheduled_job(trigger="interval", seconds=configGet("interval", "scheduler", "cache_members"))
async def cache_group_members(): async def cache_group_members():
list_of_users = [] list_of_users = []
async for member in app.get_chat_members(configGet("destination_group")): async for member in app.get_chat_members(configGet("destination_group")):
@ -20,7 +21,8 @@ async def cache_group_members():
makedirs("cache", exist_ok=True) makedirs("cache", exist_ok=True)
jsonSave(list_of_users, f"cache{sep}group_members") jsonSave(list_of_users, f"cache{sep}group_members")
@scheduler.scheduled_job(trigger="interval", seconds=40) if configGet("enabled", "scheduler", "cache_admins"):
@scheduler.scheduled_job(trigger="interval", seconds=configGet("interval", "scheduler", "cache_admins"))
async def cache_admins(): async def cache_admins():
list_of_users = [] list_of_users = []
async for member in app.get_chat_members(configGet("admin_group")): async for member in app.get_chat_members(configGet("admin_group")):