def clear_limits(context, site, limits): """Clears given limit from the site config, and removes limit from site config if its empty""" from frappe.limits import clear_limit as _clear_limit if not limits: return if not site: site = get_site(context) with frappe.init_site(site): _clear_limit(limits) # Remove limits from the site_config, if it's empty limits = get_limits() if not limits: update_site_config('limits', 'None', validate=False)