diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-11-28 09:35:31 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-01-29 14:53:44 +0100 |
commit | 234f33e01e630f763f34c51114d25986bae02b42 (patch) | |
tree | 1198fe4d097428bda731d0f2dc778ebba604b645 /lib/private | |
parent | 80560e70b7133739f87cf6a03acb55169fb2462f (diff) | |
download | nextcloud-server-234f33e01e630f763f34c51114d25986bae02b42.tar.gz nextcloud-server-234f33e01e630f763f34c51114d25986bae02b42.zip |
Close cursor early in calculateFolderSize
This method triggers additional queries in $this->update() so to avoid
potential database locks or delays, we close the cursor as soon as it is not needed any more
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/files/cache/cache.php | 3 | ||||
-rw-r--r-- | lib/private/files/cache/homecache.php | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index 7ea00325a10..8322b0f6b9c 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -540,6 +540,7 @@ class Cache { 'WHERE `parent` = ? AND `storage` = ?'; $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); if ($row = $result->fetchRow()) { + $result->closeCursor(); list($sum, $min, $unencryptedSum) = array_values($row); $sum = 0 + $sum; $min = 0 + $min; @@ -562,6 +563,8 @@ class Cache { if ($totalSize !== -1 and $unencryptedSum > 0) { $totalSize = $unencryptedSum; } + } else { + $result->closeCursor(); } } return $totalSize; diff --git a/lib/private/files/cache/homecache.php b/lib/private/files/cache/homecache.php index 2b3967c8807..ad7f587b8b6 100644 --- a/lib/private/files/cache/homecache.php +++ b/lib/private/files/cache/homecache.php @@ -35,6 +35,7 @@ class HomeCache extends Cache { 'WHERE `parent` = ? AND `storage` = ? AND `size` >= 0'; $result = \OC_DB::executeAudited($sql, array($id, $this->getNumericStorageId())); if ($row = $result->fetchRow()) { + $result->closeCursor(); list($sum, $unencryptedSum) = array_values($row); $totalSize = 0 + $sum; $unencryptedSize = 0 + $unencryptedSum; |