perf: handle clearing large oauth token table

This commit is contained in:
Ankush Menat 2025-04-17 17:58:07 +05:30
parent 2a5506ebc3
commit acea1aedbf
5 changed files with 17 additions and 4 deletions

View file

@ -154,6 +154,7 @@ LOG_DOCTYPES = [
"Email Queue",
"Email Queue Recipient",
"Error Log",
"OAuth Bearer Token",
]

View file

@ -58,7 +58,8 @@
"fieldname": "expiration_time",
"fieldtype": "Datetime",
"label": "Expiration time",
"read_only": 1
"read_only": 1,
"search_index": 1
},
{
"fieldname": "expires_in",
@ -77,7 +78,7 @@
}
],
"links": [],
"modified": "2025-01-15 17:54:35.661941",
"modified": "2025-04-17 17:57:52.268893",
"modified_by": "Administrator",
"module": "Integrations",
"name": "OAuth Bearer Token",
@ -95,7 +96,8 @@
"share": 1
}
],
"row_format": "Dynamic",
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}
}

View file

@ -0,0 +1,9 @@
from contextlib import suppress
from frappe.core.doctype.log_settings.log_settings import clear_log_table
def execute():
"""Clear old tokens"""
with suppress(Exception):
clear_log_table("OAuth Bearer Token")

View file

@ -196,6 +196,7 @@ execute:frappe.reload_doc("desk", "doctype", "Form Tour")
execute:frappe.delete_doc('Page', 'recorder', ignore_missing=True, force=True)
frappe.patches.v14_0.modify_value_column_size_for_singles
frappe.patches.v15_0.migrate_to_utm
frappe.integrations.doctype.oauth_bearer_token.patches.clear_old_tokens
[post_model_sync]
execute:frappe.get_doc('Role', 'Guest').save() # remove desk access
@ -244,4 +245,4 @@ frappe.desk.doctype.workspace.patches.update_app
frappe.patches.v16_0.move_role_desk_settings_to_user
frappe.printing.doctype.print_format.patches.sets_wkhtmltopdf_as_default_for_pdf_generator_field
frappe.patches.v14_0.fix_user_settings_collation
execute:frappe.core.doctype.system_settings.system_settings.sync_system_settings
execute:frappe.core.doctype.system_settings.system_settings.sync_system_settings