mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-16 14:25:19 -05:00
Default to saving stuff more often to minimize lag caused by a single save
This commit is contained in:
parent
251b015210
commit
941176cd65
@ -106,8 +106,8 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("max_block_generate_distance", "5");
|
settings->setDefault("max_block_generate_distance", "5");
|
||||||
settings->setDefault("time_send_interval", "20");
|
settings->setDefault("time_send_interval", "20");
|
||||||
settings->setDefault("time_speed", "96");
|
settings->setDefault("time_speed", "96");
|
||||||
settings->setDefault("server_unload_unused_data_timeout", "60");
|
settings->setDefault("server_unload_unused_data_timeout", "19");
|
||||||
settings->setDefault("server_map_save_interval", "10");
|
settings->setDefault("server_map_save_interval", "1.238");
|
||||||
settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
|
settings->setDefault("full_block_send_enable_min_time_from_building", "2.0");
|
||||||
settings->setDefault("enable_experimental", "false");
|
settings->setDefault("enable_experimental", "false");
|
||||||
}
|
}
|
||||||
|
16
src/map.cpp
16
src/map.cpp
@ -2836,7 +2836,9 @@ void ServerMap::save(bool only_changed)
|
|||||||
u32 block_count = 0;
|
u32 block_count = 0;
|
||||||
u32 block_count_all = 0; // Number of blocks in memory
|
u32 block_count_all = 0; // Number of blocks in memory
|
||||||
|
|
||||||
beginSave();
|
// Don't do anything with sqlite unless something is really saved
|
||||||
|
bool save_started = false;
|
||||||
|
|
||||||
core::map<v2s16, MapSector*>::Iterator i = m_sectors.getIterator();
|
core::map<v2s16, MapSector*>::Iterator i = m_sectors.getIterator();
|
||||||
for(; i.atEnd() == false; i++)
|
for(; i.atEnd() == false; i++)
|
||||||
{
|
{
|
||||||
@ -2852,7 +2854,6 @@ void ServerMap::save(bool only_changed)
|
|||||||
sector->getBlocks(blocks);
|
sector->getBlocks(blocks);
|
||||||
core::list<MapBlock*>::Iterator j;
|
core::list<MapBlock*>::Iterator j;
|
||||||
|
|
||||||
//sqlite3_exec(m_database, "BEGIN;", NULL, NULL, NULL);
|
|
||||||
for(j=blocks.begin(); j!=blocks.end(); j++)
|
for(j=blocks.begin(); j!=blocks.end(); j++)
|
||||||
{
|
{
|
||||||
MapBlock *block = *j;
|
MapBlock *block = *j;
|
||||||
@ -2862,7 +2863,14 @@ void ServerMap::save(bool only_changed)
|
|||||||
if(block->getModified() >= MOD_STATE_WRITE_NEEDED
|
if(block->getModified() >= MOD_STATE_WRITE_NEEDED
|
||||||
|| only_changed == false)
|
|| only_changed == false)
|
||||||
{
|
{
|
||||||
|
// Lazy beginSave()
|
||||||
|
if(!save_started){
|
||||||
|
beginSave();
|
||||||
|
save_started = true;
|
||||||
|
}
|
||||||
|
|
||||||
modprofiler.add(block->getModifiedReason(), 1);
|
modprofiler.add(block->getModifiedReason(), 1);
|
||||||
|
|
||||||
saveBlock(block);
|
saveBlock(block);
|
||||||
block_count++;
|
block_count++;
|
||||||
|
|
||||||
@ -2872,10 +2880,10 @@ void ServerMap::save(bool only_changed)
|
|||||||
<<block->getPos().Z<<")"
|
<<block->getPos().Z<<")"
|
||||||
<<std::endl;*/
|
<<std::endl;*/
|
||||||
}
|
}
|
||||||
//sqlite3_exec(m_database, "COMMIT;", NULL, NULL, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endSave();
|
if(save_started)
|
||||||
|
endSave();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Only print if something happened or saved whole map
|
Only print if something happened or saved whole map
|
||||||
|
@ -1300,7 +1300,7 @@ void Server::AsyncRunStep()
|
|||||||
m_env->step(dtime);
|
m_env->step(dtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float map_timer_and_unload_dtime = 5.15;
|
const float map_timer_and_unload_dtime = 2.92;
|
||||||
if(m_map_timer_and_unload_interval.step(dtime, map_timer_and_unload_dtime))
|
if(m_map_timer_and_unload_interval.step(dtime, map_timer_and_unload_dtime))
|
||||||
{
|
{
|
||||||
JMutexAutoLock lock(m_env_mutex);
|
JMutexAutoLock lock(m_env_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user