mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-16 08:42:25 +00:00
Update database.cpp
This commit is contained in:
parent
3c4cc74a54
commit
2174f41505
@ -2299,11 +2299,26 @@ void Database::ConvertInventoryToNewUniqueId()
|
||||
}
|
||||
|
||||
TransactionBegin();
|
||||
uint32 index = 0;
|
||||
uint32 batch_size = 1000;
|
||||
std::vector<InventoryRepository::Inventory> queue{};
|
||||
queue.reserve(batch_size);
|
||||
|
||||
for (auto &r: results) {
|
||||
r.item_unique_id = EQ::UniqueHashGenerator::generate();
|
||||
queue.push_back(r);
|
||||
index++;
|
||||
if (index >= batch_size) {
|
||||
InventoryRepository::ReplaceMany(*this, queue);
|
||||
index = 0;
|
||||
queue.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (!queue.empty()) {
|
||||
InventoryRepository::ReplaceMany(*this, queue);
|
||||
}
|
||||
|
||||
InventoryRepository::ReplaceMany(*this, results);
|
||||
TransactionCommit();
|
||||
LogInfo("Converted {} records", results.size());
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user