Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-05-17 18:03:42 +0300
committerVincent Petry <pvince81@owncloud.com>2016-05-17 18:15:09 +0300
commitdfc0a7a4a60bf93f09c2ea210ebb440f1703a8a9 (patch)
treeb587958e9745559749c534f198c6dfba2c98bf58 /lib
parent56031fe1555e011ee9be56547cd597c6dbcf4c22 (diff)
Allow chunk GC mtime tolerance for unfinished part chunks
Whenever part chunks are written, every fwrite in the write loop will reset the mtime to the current mtime. Only at the end will the touch() operation set the mtime to now + ttl, in the future. However the GC code is expecting that every chunk with mtime < now are old and must be deleted. This causes the GC to sometimes delete part chunks in which the write loop is slow. To fix this, a tolerance value is added in the GC code to allow for more time before a part chunk gets deleted.
Diffstat (limited to 'lib')
-rw-r--r--lib/private/cache/file.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/cache/file.php b/lib/private/cache/file.php
index 989e05275b7..38f88959bd7 100644
--- a/lib/private/cache/file.php
+++ b/lib/private/cache/file.php
@@ -172,7 +172,9 @@ class File implements ICache {
public function gc() {
$storage = $this->getStorage();
if ($storage and $storage->is_dir('/')) {
- $now = time();
+ // extra hour safety, in case of stray part chunks that take longer to write,
+ // because touch() is only called after the chunk was finished
+ $now = time() - 3600;
$dh = $storage->opendir('/');
if (!is_resource($dh)) {
return null;