SB-MaterialAdmin / Web

SourceBans Material Design
64 stars 45 forks source link

[BUG] Slow Ban Adding #321

Closed BlackYuzia closed 2 years ago

BlackYuzia commented 3 years ago

Description

When you try add a ban from web, you should wait 20-30 seconds before ban would be accept and a few seconds before you get redirect.

To Reproduce Steps to reproduce short: try add ban from stable-dev branch.

Expected behavior Fast add ban the same like on old versions of web

Screenshots @CrazyHackGUT have a few mp4 videos.

CrazyHackGUT commented 3 years ago

Can't reproduce. Need more details.

BlackYuzia commented 3 years ago

@CrazyHackGUT you have access now, you can try.

CrazyHackGUT commented 2 years ago

Now, i have all additional details.

This can be reproducable only if:

  1. User have too many administrators (in case of @BlackYuzia - 900+ administrators)
  2. Ban performs by SteamID.

When any administrator performs ban by SteamID, legacy code tries lookup administrator entry via CUserManager::GetAllAdmins(). This method retrieves all administrator identifiers, then fetch all administrators via one query for one administrator, what causes 901+ queries (in case of @BlackYuzia).

I guess we can fix it via trying find administrator via SteamID without fetching full administrator list. Also this issue can persist in SB++.

CrazyHackGUT commented 2 years ago

https://github.com/SB-MaterialAdmin/Web/commit/bf28abd86f388d89491bd0b9cc5cc3788f8d3d8d fixed this.