[Pkg-owncloud-commits] [owncloud] 66/90: Close cursor early in calculateFolderSize

David Prévot taffit at moszumanska.debian.org
Fri Feb 6 21:10:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 234f33e01e630f763f34c51114d25986bae02b42
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Fri Nov 28 09:35:31 2014 +0100

    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
---
 lib/private/files/cache/cache.php     | 3 +++
 lib/private/files/cache/homecache.php | 1 +
 2 files changed, 4 insertions(+)

diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 7ea0032..8322b0f 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 2b3967c..ad7f587 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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list