[Pawn] Long callback execution - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) --- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) --- Thread: [Pawn] Long callback execution (/showthread.php?tid=1973) |
Long callback execution - Snow - 2021-05-02 I am getting tons of long callback executions in my server logs, People told me the that I need to shorten my functions and optimize the code. This is one of the functions that also detects long callback execution. So I'm gonna need an example from this to fix the long execution. Hoping to get some help here.? Code: public OnPlayerExitVehicle(playerid, vehicleid) RE: Long callback execution - Y_Less - 2021-05-02 Well the question there is, how many burrito vans do you have? However, the long callback is the whole callback, so do you have any other hooks of that callback? RE: Long callback execution - kemper - 2021-05-02 I wouldn't call this code terrible or something. But there is a logical error. If you have met the condition you need, then break out of the loop. Also you already know vehicleid so you don't need to call GetPlayerVehicleID every time. Code: public OnPlayerExitVehicle(playerid, vehicleid) RE: Long callback execution - Y_Less - 2021-05-02 No, that code isn't terrible at all. It is correct that there are a few minor improvements that could be made, but I didn't even bother mentioning them because they are no where near significant enough to trigger the slow code warning. That's why I asked about other hooks of the same callback, ones that might have far more code in. Alternatively, could you post the exact error from the console? RE: Long callback execution - Snow - 2021-05-03 So here's something weird happening. I tried commenting the whole callback to see if it still happens and yeah, I'm still getting the warning in the console. I've checked all the includes manually to look for OnPlayerExitVehicle (except for ysi includes and mysql) and didn't find any hooks. Here's the direct code from the console Code: [debug] Long callback execution detected (hang or performance issue) RE: Long callback execution - AbyssMorgan - 2021-05-03 When you create Burrito vehicles add flag for burito vehicle and store burito id if you need Code: for(new i; i < sizeof(Burrito_ID); i) Then you dont need loop Code: public OnPlayerExitVehicle(playerid, vehicleid) RE: Long callback execution - Y_Less - 2021-05-03 I still really don't think the problem is there. None of those calls even look like the code in your callback. But the best way to know is to recompile with `-d3`, which will allow the error message to display the full function names. RE: Long callback execution - Snow - 2021-05-03 Hi. This is what I got with d3 enabled. Code: [debug] Long callback execution detected (hang or performance issue) I believe this has to do something with the ysi includes or the amx assembly? RE: Long callback execution - Y_Less - 2021-05-03 OK, I'm not sure why but the main callback is being misreported. The good news is that this is therefore an init function and you don't need to worry about it. Try update YSI anyway, as the later versions should disable that warning in `OnScriptInit`. RE: Long callback execution - Snow - 2021-05-03 (2021-05-03, 03:48 PM)Y_Less Wrote: OK, I'm not sure why but the main callback is being misreported.? The good news is that this is therefore an init function and you don't need to worry about it.? Try update YSI anyway, as the later versions should disable that warning in `OnScriptInit`. Weird, because I am already using the latest YSI includes from the github. |