async def post_firmware_updates(): """ Send firmware updates to subscribers every 65 minutes """ while True: new_updates = await diff_updates(PROVIDER.firmware_data, PROVIDER.bak_firmware_data) if not new_updates: await sleep(65 * 60) continue for codename, updates in new_updates.items(): subscriptions = DATABASE.get_subscriptions('firmware', codename) if subscriptions: for subscription in subscriptions: for update in updates: locale = DATABASE.get_locale(subscription[0]) message, buttons = await firmware_update_message(codename, update, locale) await post_update(subscription, message, buttons) await sleep(2) await sleep(65 * 60)
async def post_miui_updates(): """ Send miui updates to subscribers every 65 minutes """ while True: new_updates = await diff_miui_updates(PROVIDER.miui_updates, PROVIDER.bak_miui_updates) if not new_updates: await sleep(65 * 60) continue for codename, updates in new_updates.items(): subscriptions = DATABASE.get_subscriptions('miui', codename) if subscriptions: for subscription in subscriptions: for update in updates: locale = DATABASE.get_locale(subscription[0]) message, buttons = await miui_update_message( update, PROVIDER.codenames_names, locale) await post_update(subscription, message, buttons) await sleep(2) await sleep(65 * 60)