Skip to content

fix(SAI/Handler): cache entity name#3533

Merged
FrancescoBorzi merged 6 commits into
azerothcore:masterfrom
TheSCREWEDSoftware:attempt_to_fix_queries_24_7
Sep 15, 2025
Merged

fix(SAI/Handler): cache entity name#3533
FrancescoBorzi merged 6 commits into
azerothcore:masterfrom
TheSCREWEDSoftware:attempt_to_fix_queries_24_7

Conversation

@TheSCREWEDSoftware

Copy link
Copy Markdown
Contributor

Closes: #3500

Prior to this you would run TOO MANY queries (at the end of this PR) in milliseconds

  • For libs\shared\sai-editor\src\sai-editor.component.html

Now uses selectedName$ instead of getHandler().getName()

  • libs\shared\sai-editor\src\sai-editor.component.ts

Now "caches" the value being looked/searched and only updates / run the query if any changes happen instead of checking multiple times a milisecond.
SELECT ct.name FROM creature_template AS ct INNER JOIN creature AS c ON c.id1 = ct.entry WHERE c.guid = $ID

https://gist.github.com/TheSCREWEDSoftware/52981434a8615ae770e638125071df97

@TheSCREWEDSoftware

Copy link
Copy Markdown
Contributor Author

Only does this once
image

Until updated

@TheSCREWEDSoftware

Copy link
Copy Markdown
Contributor Author

CC @FrancescoBorzi

Comment thread libs/shared/sai-editor/src/sai-editor.component.ts Outdated
@TheSCREWEDSoftware

Copy link
Copy Markdown
Contributor Author

Un-related to this, on startup

[11488:0915/133059.679:ERROR:CONSOLE:2] "Uncaught (in promise) Error: Error invoking remote method 'BROWSER_GET_LAST_WEB_PREFERENCES': WebContents does not exist", source: node:electron/js2c/sandbox_bundle (2)
[11488:0915/133100.484:ERROR:CONSOLE:1] "Request Autofill.enable failed. {"code":-32601,"message":"'Autofill.enable' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1)
[11488:0915/133100.484:ERROR:CONSOLE:1] "Request Autofill.setAddresses failed. {"code":-32601,"message":"'Autofill.setAddresses' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1)

Doing the way you asked, not i've to figure out how to cache the observable, otherwise just has the same behaviour as before

image

@TheSCREWEDSoftware

Copy link
Copy Markdown
Contributor Author
image image image

CC @FrancescoBorzi

@FrancescoBorzi FrancescoBorzi changed the title Only run the query when data changes fix(SAI): cache entity name Sep 15, 2025
@FrancescoBorzi FrancescoBorzi changed the title fix(SAI): cache entity name fix(SAI/Handler): cache entity name Sep 15, 2025
@FrancescoBorzi FrancescoBorzi merged commit 943f0e4 into azerothcore:master Sep 15, 2025
12 checks passed
@FrancescoBorzi

Copy link
Copy Markdown
Collaborator

very good, thanks @TheSCREWEDSoftware

@TheSCREWEDSoftware TheSCREWEDSoftware deleted the attempt_to_fix_queries_24_7 branch September 15, 2025 20:46
@Helias

Helias commented Sep 19, 2025

Copy link
Copy Markdown
Member

very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Critical] - Search by entity of non-existing entries will cause high usage of the CPU

4 participants