mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: Cache Discourse.system_user
separately for each multisite tenant (#8276)
This was not causing any known issue, because the system user ID is always the same across all sites. However, we should cache this on a per-site basis to be safe.
This commit is contained in:
@ -536,7 +536,9 @@ module Discourse
|
||||
SYSTEM_USER_ID ||= -1
|
||||
|
||||
def self.system_user
|
||||
@system_user ||= User.find_by(id: SYSTEM_USER_ID)
|
||||
@system_users ||= {}
|
||||
current_db = RailsMultisite::ConnectionManagement.current_db
|
||||
@system_users[current_db] ||= User.find_by(id: SYSTEM_USER_ID)
|
||||
end
|
||||
|
||||
def self.store
|
||||
|
Reference in New Issue
Block a user