Skip to content

Commit 3b6a0ee

Browse files
authored
fix: implement on chunked upload v2
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
1 parent 7064fe3 commit 3b6a0ee

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

apps/dav/lib/BackgroundJob/UploadCleanup.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use OCP\Files\Folder;
1717
use OCP\Files\IRootFolder;
1818
use OCP\Files\NotFoundException;
19+
use OCP\IConfig;
20+
use OCP\Server;
1921
use Psr\Log\LoggerInterface;
2022

2123
class UploadCleanup extends TimedJob {
@@ -47,8 +49,9 @@ protected function run($argument) {
4749
return;
4850
}
4951

50-
// Remove if all files have an mtime of more than a day
51-
$time = $this->time->getTime() - 60 * 60 * 24;
52+
// Remove if all files have an mtime of more than a day or configured TTL
53+
$ttl = Server::get(IConfig::class)->getSystemValueInt('cache_chunk_gc_ttl', 60 * 60 * 24);
54+
$time = $this->time->getTime() - $ttl;
5255

5356
if (!($uploadFolder instanceof Folder)) {
5457
$this->logger->error('Found a file inside the uploads folder. Uid: ' . $uid . ' folder: ' . $folder);
@@ -61,8 +64,6 @@ protected function run($argument) {
6164

6265
/** @var File[] $files */
6366
$files = $uploadFolder->getDirectoryListing();
64-
65-
// The folder has to be more than a day old
6667
$initial = $uploadFolder->getMTime() < $time;
6768

6869
$expire = array_reduce($files, function (bool $carry, File $file) use ($time) {

0 commit comments

Comments
 (0)