From f9eb31f317ed2de61f6a57fb6d99604aa9d13b94 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 24 Oct 2015 08:20:42 +0200 Subject: Flush rollback log more often Flushes the buffer of rollback actions that wait to get saved in two more situations: 1. Flushes in the destructor of the rollback. This makes the server not forget the last < 500 rollback entries when it shuts down. 2. Flushes the rollback when /rollback_check is invoked. This is neccessary as otherwise it leads to confusion if users want to test the rollback functionality by placing a node and then executing the check on it, or if the actions were very recent out of other reasons. --- src/rollback.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/rollback.cpp') diff --git a/src/rollback.cpp b/src/rollback.cpp index a6b79393a..3d264b880 100644 --- a/src/rollback.cpp +++ b/src/rollback.cpp @@ -107,6 +107,8 @@ RollbackManager::RollbackManager(const std::string & world_path, RollbackManager::~RollbackManager() { + flush(); + SQLOK(sqlite3_finalize(stmt_insert)); SQLOK(sqlite3_finalize(stmt_replace)); SQLOK(sqlite3_finalize(stmt_select)); @@ -930,6 +932,7 @@ std::list RollbackManager::getEntriesSince(time_t first_time) std::list RollbackManager::getNodeActors(v3s16 pos, int range, time_t seconds, int limit) { + flush(); time_t cur_time = time(0); time_t first_time = cur_time - seconds; -- cgit v1.2.3