Download: Don't trigger too many concurrent hash computations
authorChristian Kamm <mail@ckamm.de>
Mon, 12 Aug 2019 06:23:40 +0000 (08:23 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:55 +0000 (10:58 +0100)
commitea829f96cad1a3ee794cffd024e6eec3bca81e59
treeeddba6c0ea9401c94b4af85228d0a7433b4c70a7
parent8a5a185752e0003d899480da51e476917982a14c
Download: Don't trigger too many concurrent hash computations

Previously the job would only become "active" when the downloads
started. That meant that arbitrarily many hash computations could be
queued at the same time.

Since the the file was opened during future creation this could lead to
a "too many open files" problem if there were lots of new-new conflicts.

To change this:
- Make PropagateDownload become active when computing a hash
  asynchronously.
- Make the computation future open the file only once it gets run. This
  will make it less likely for this problem to occur even if thousands
  of these futures are queued.

For #7372
src/common/checksums.cpp
src/libsync/propagatedownload.cpp