opentibiabr / canary

Canary Server 13.x for OpenTibia community.
https://docs.opentibiabr.com/
GNU General Public License v2.0
341 stars 560 forks source link

Persistence in force exit kicked timeout #2720

Open TheLionEscanor opened 1 week ago

TheLionEscanor commented 1 week ago

Priority

Medium

Area

What happened?

Captura

What OS are you seeing the problem on?

Windows

Code of Conduct

pedrohfk commented 6 days ago

@TheLionEscanor This error is occurring because of hirelings, causing the server and players to crash.

pedrohfk commented 6 days ago

@TheLionEscanor

On: \canary\data\libs\systems\hireling.lua

` function SaveHirelings()

local successCount = 0
local failedCount = 0

for _, hireling in ipairs(HIRELINGS) do
    local success = hireling:save()
    print(success)
    if not success then
        failedCount = failedCount + 1
        logger.warn("Failed to save hireling: {} (ID: {}).", hireling:getName(), hireling:getId())
    else
        successCount = successCount + 1
    end
end

if successCount == #HIRELINGS then
    logger.info("All hirelings successfully saved.")
else
    logger.warn("Failed to save {} hirelings.", failedCount)
end

end`

success will always return null (nill)

I'm back to the way I was before.

function SaveHirelings() for _, hireling in ipairs(HIRELINGS) do hireling:save() end end

TheLionEscanor commented 6 days ago

That does not sound consistent, since that only occurs with a forced exit or disconnection, while hirelings are saved in global save