Skip to content

Commit a71f8ed

Browse files
committed
Catched SQLITE_BUSY exception.
1 parent 7d15dbf commit a71f8ed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

TileGenerator.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <gdfontmb.h>
1414
#include <iostream>
1515
#include <sstream>
16+
#include <unistd.h>
1617
#include "config.h"
1718
#include "PlayerAttributes.h"
1819
#include "TileGenerator.h"
@@ -301,6 +302,9 @@ void TileGenerator::loadBlocks()
301302
}
302303
m_positions.push_back(std::pair<int, int>(pos.x, pos.z));
303304
}
305+
else if (result == SQLITE_BUSY) {
306+
usleep(10000);
307+
}
304308
else {
305309
break;
306310
}
@@ -613,6 +617,9 @@ std::map<int, TileGenerator::BlockList> TileGenerator::getBlocksOnZ(int zPos, sq
613617
BlockPos pos = decodeBlockPos(blocknum);
614618
blocks[pos.x].push_back(Block(pos, unsigned_string(data, size)));
615619
}
620+
else if (result == SQLITE_BUSY) {
621+
usleep(10000);
622+
}
616623
else {
617624
break;
618625
}

0 commit comments

Comments
 (0)