diff --git a/NETWORKING.md b/NETWORKING.md
index ed7d72ceb..a6c448461 100644
--- a/NETWORKING.md
+++ b/NETWORKING.md
@@ -153,6 +153,9 @@ The current server configuration xml looks like this:
+
+
+
diff --git a/src/network/protocols/server_lobby.cpp b/src/network/protocols/server_lobby.cpp
index 20be6cf02..0b0277960 100644
--- a/src/network/protocols/server_lobby.cpp
+++ b/src/network/protocols/server_lobby.cpp
@@ -191,8 +191,8 @@ void ServerLobby::initDatabase()
}
sqlite3_busy_handler(m_db, [](void* data, int retry)
{
- // Maximum 1 second total retry time
- if (retry < 10)
+ int retry_count = ServerConfig::m_database_timeout / 100;
+ if (retry < retry_count)
{
sqlite3_sleep(100);
// Return non-zero to let caller retry again
diff --git a/src/network/server_config.hpp b/src/network/server_config.hpp
index c8a2a5bd1..363119d81 100644
--- a/src/network/server_config.hpp
+++ b/src/network/server_config.hpp
@@ -333,6 +333,13 @@ namespace ServerConfig
"for each server. You need to create the database yourself first, see "
"NETWORKING.md for details"));
+ SERVER_CFG_PREFIX IntServerConfigParam m_database_timeout
+ SERVER_CFG_DEFAULT(IntServerConfigParam(1000,
+ "database-timeout",
+ "Specified in millisecond for maximum time waiting in "
+ "sqlite3_busy_handler. You may need a higher value if your database "
+ "is shared by many servers or having a slow hard disk."));
+
SERVER_CFG_PREFIX StringServerConfigParam m_ip_ban_table
SERVER_CFG_DEFAULT(StringServerConfigParam("ip_ban",
"ip-ban-table",