cache: Synchronize downloading

This commit adds code to synchronize downloading files to the cache.
Before, requests that came in for files currently downloading would fail
because the file was not completed in the cache. Now, the code waits
until the download is completed.

Closes #1278
This commit is contained in:
Alexander Neumann 2017-09-25 15:21:16 +02:00
parent 2e72b57f2f
commit 0bb2a8e0d0
2 changed files with 63 additions and 5 deletions

View file

@ -155,10 +155,7 @@ func (c *Cache) IsNotExist(err error) bool {
// Wrap returns a backend with a cache.
func (c *Cache) Wrap(be restic.Backend) restic.Backend {
return &Backend{
Backend: be,
Cache: c,
}
return newBackend(be, c)
}
// BaseDir returns the base directory.