Skip to content

Commit

Permalink
fix(skymp5-server): fix division by 0 in MongoDatabase (skyrim-multip…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pospelove authored Oct 14, 2024
1 parent 47eb250 commit 75ce3cc
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ void MongoDatabase::Iterate(const IterateCallback& iterateCallback)

int numParts = std::min(totalDocuments, 100);

int partSize = totalDocuments / numParts;

std::atomic<int> totalDocumentsProcessed = 0;

std::string hash;
Expand Down Expand Up @@ -157,6 +155,7 @@ void MongoDatabase::Iterate(const IterateCallback& iterateCallback)
// space is to be replaced with ] in case of empty array
threadsDocumentsJsonArray[i] = "[ ";

int partSize = totalDocuments / numParts;
auto skip = i * partSize;
auto limit = (i == numParts - 1) ? totalDocuments - skip : partSize;

Expand Down

0 comments on commit 75ce3cc

Please sign in to comment.