🐛 erasing users should set save flag

This commit is contained in:
EntireTwix 2021-07-20 00:09:16 -07:00
parent b66f2dc562
commit e610615e5f

View file

@ -203,13 +203,20 @@ BankResponse Bank::PruneUsers(time_t threshold_time, uint32_t threshold_bal) noe
size_t deleted_count = 0; size_t deleted_count = 0;
for (const auto &u : users) for (const auto &u : users)
{ {
users.erase_if(u.first, [threshold_time, threshold_bal, &deleted_count](User &u) -> bool { users.erase_if(u.first, [this, threshold_time, threshold_bal, &deleted_count](User &u) -> bool {
#if MAX_LOG_SIZE > 0 #if MAX_LOG_SIZE > 0
if (u.log.data.back().time < threshold_time && u.balance < threshold_bal) if (u.log.data.back().time < threshold_time && u.balance < threshold_bal)
#else #else
if (u.balance < threshold_bal) if (u.balance < threshold_bal)
#endif #endif
{ {
#if CONSERVATIVE_DISK_SAVE
#if MULTI_THREADED
save_flag.SetChangesOn();
#else
save_flag = true;
#endif
#endif
return ++deleted_count; return ++deleted_count;
} }
else else