mirror of
https://github.com/Expand-sys/CCash
synced 2025-12-17 00:22:14 +11:00
🔥 removed Save changes
This commit is contained in:
parent
7c4da5771f
commit
46c9eb7b7e
1 changed files with 4 additions and 10 deletions
|
|
@ -120,23 +120,17 @@ public:
|
|||
std::ofstream user_save("users.json");
|
||||
Json::Value temp;
|
||||
|
||||
std::vector<std::string> temp_names;
|
||||
temp_names.reserve(users.size());
|
||||
{
|
||||
std::unique_lock<std::shared_mutex> lock{save_lock}; //grabbing it from any busy add/del opperations
|
||||
for (const auto &u : users)
|
||||
{
|
||||
temp_names.push_back(u.first);
|
||||
//we know it contains this key but we call this func to grab mutex
|
||||
users.if_contains(u.first, [&temp, &u](const User &u_val) {
|
||||
temp[u.first] = u_val.Serialize();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::string &s : temp_names)
|
||||
{
|
||||
users.if_contains(s, [&temp, &s](const User &u) {
|
||||
temp[s] = u.Serialize();
|
||||
});
|
||||
}
|
||||
|
||||
writer->write(temp, &user_save);
|
||||
user_save.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue