Close database when done
This prevents messages 'Connection reset by peer' in the postgresql log file. It might have benefits for other databases as well ?
This commit is contained in:
parent
ba9166fd79
commit
dbec678f6b
@ -202,6 +202,7 @@ TileGenerator::TileGenerator():
|
||||
|
||||
TileGenerator::~TileGenerator()
|
||||
{
|
||||
closeDb();
|
||||
}
|
||||
|
||||
void TileGenerator::setSilenceSuggestion(unsigned flags)
|
||||
@ -557,6 +558,7 @@ void TileGenerator::generate(const std::string &input, const std::string &output
|
||||
if (!m_drawObjects.empty()) {
|
||||
renderDrawObjects();
|
||||
}
|
||||
closeDb();
|
||||
if (progressIndicator)
|
||||
cout << "Writing image...\r" << std::flush;
|
||||
writeImage(output);
|
||||
@ -859,6 +861,14 @@ void TileGenerator::openDb(const std::string &input)
|
||||
throw std::runtime_error(((std::string) "World uses backend '") + m_backend + ", which was not enabled at compile-time.");
|
||||
}
|
||||
|
||||
void TileGenerator::closeDb()
|
||||
{
|
||||
if (m_db) {
|
||||
delete m_db;
|
||||
m_db = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void TileGenerator::loadBlocks()
|
||||
{
|
||||
int mapXMin, mapXMax;
|
||||
|
@ -162,6 +162,7 @@ private:
|
||||
std::string getWorldDatabaseBackend(const std::string &input);
|
||||
int getMapChunkSize(const std::string &input);
|
||||
void openDb(const std::string &input);
|
||||
void closeDb();
|
||||
void sanitizeParameters(void);
|
||||
void loadBlocks();
|
||||
void createImage();
|
||||
|
Loading…
x
Reference in New Issue
Block a user