Open Yehonal opened 3 years ago
bump
4669
not sure if that is related to this problem
Any updates here? @Winfidonarleyan were you working on Async recently?
not sure if @UltraNix did something about this recently
Nope.
Any updates here? @Winfidonarleyan were you working on Async recently?
No
I've found a technical issue related to the way certain functions are using the AsyncQuery method.
Intro: What is AsyncQuery in AC
Currently we have 3 ways to execute a query:
Enqueue without result (Execute) pro: it doesn't lock the db so doesn't cause performance issues cons: doesn't return anything and you cannot write sequential code
Execute with sync result (Query) pro: returns the result of the query and you can write sequential code cons: it locks the db so can cause performance issues
Enqueue with async result (AsyncQuery) pro: returns the result of the query and you can write async code cons: it's a bit more complex to use (not 1 line of code)
Issue N.1: Pets etc.
I've noticed that certain methods are using the AsyncQuery as they were synchronous instead.
This is the list of wrongly used async queries:
https://github.com/azerothcore/azerothcore-wotlk/blob/4b7454574412cfe23bb5902b9b3d42d2313b3541/src/server/game/Handlers/NPCHandler.cpp#L590
https://github.com/azerothcore/azerothcore-wotlk/blob/4b7454574412cfe23bb5902b9b3d42d2313b3541/src/server/game/Entities/Pet/Pet.cpp#L103
(huge file, i've attached the screenshot) https://github.com/azerothcore/azerothcore-wotlk/blob/master/src/server/game/Entities/Player/Player.cpp#L28232
I'm not 99% sure but I think that every time you run those queries in the best scenario it's a gamble against your I/O speed, in the worst scenario instead that logic is completely broken
Issue N.2: Complexity (optional)
Would be great to find a way to allow devs to easily use the AsyncQuery approach since, in my opinion, it should be vastly used especially for scripts.