Rafael Hamdan
OT Developer
Just don't talk about you don't know. I'm using newest revision of TFS (Trunk), without much changes, but every time the server is saved, it causes a freeze of about 2 seconds.
Using it on sources, the server freezes about 0.5 sec (almost nothing). My script (npc):
Maybe my script was sux and I didn't know, anh?
My code on sources is almost the same, look:
and at otserv.cpp
Yours,
Rafael Hamdan;
Using it on sources, the server freezes about 0.5 sec (almost nothing). My script (npc):
Code:
local SAVE_FREQUENCE = 20 * 60 * 2 * 2 -- seconds, x2 because onThink is executed every 500ms
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local saveTimer = SAVE_FREQUENCE
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink()
saveTimer = saveTimer - 2
if saveTimer == 0 then
doBroadcastMessage("Welcome to HellPiece OTServer.");
saveServer()
saveTimer = SAVE_FREQUENCE
end
npcHandler:onThink()
end
npcHandler:addModule(FocusModule:new())
Maybe my script was sux and I didn't know, anh?
My code on sources is almost the same, look:
Code:
void Game::autoSaveData()
{
std::cout << ">> Server has been saved. " << std::endl;
setGameState(GAME_STATE_SAVE);
Scheduler::getScheduler().addEvent(createSchedulerTask(g_config.getNumber(ConfigManager::AUTOSAVE_FREQ), boost::bind(&Game::autoSaveData, this)));
}
and at otserv.cpp
Code:
std::cout << ">> Auto server save time: " << g_config.getNumber(ConfigManager::AUTOSAVE_FREQ) / 60000 << " minutes."<< std::endl;
Scheduler::getScheduler().addEvent(createSchedulerTask(g_config.getNumber(ConfigManager::AUTOSAVE_FREQ), boost::bind(&Game::autoSaveData, &g_game)));
Yours,
Rafael Hamdan;
Last edited: