Check completed downloads size only after the database is loaded.

This commit is contained in:
levlam 2022-09-05 17:58:15 +03:00
parent e843343a22
commit cc4194a406

View File

@ -775,6 +775,10 @@ class DownloadManagerImpl final : public DownloadManager {
}
void check_completed_downloads_size() {
if (!is_database_loaded_) {
return;
}
constexpr size_t MAX_COMPLETED_DOWNLOADS = 200;
while (completed_download_ids_.size() > MAX_COMPLETED_DOWNLOADS) {
auto download_id = *completed_download_ids_.begin();