perf: duplicate database initialization (#18049)

This commit is contained in:
Ankush Menat 2022-09-07 11:32:00 +05:30 committed by GitHub
parent b47205ff01
commit 3e92bab1d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ import frappe
import frappe.database
import frappe.utils
import frappe.utils.user
from frappe import _, conf
from frappe import _
from frappe.core.doctype.activity_log.activity_log import add_authentication_log
from frappe.modules.patch_handler import check_session_stopped
from frappe.sessions import Session, clear_sessions, delete_session
@ -30,9 +30,6 @@ class HTTPRequest:
# load cookies
self.set_cookies()
# set frappe.local.db
self.connect()
# login and start/resume user session
self.set_session()
@ -97,16 +94,6 @@ class HTTPRequest:
def set_lang(self):
frappe.local.lang = get_language()
def get_db_name(self):
"""get database name from conf"""
return conf.db_name
def connect(self):
"""connect to db, from ac_name or db_name"""
frappe.local.db = frappe.database.get_db(
user=self.get_db_name(), password=getattr(conf, "db_password", "")
)
class LoginManager: