aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Diagnostics/QueryLogger.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Diagnostics/QueryLogger.php')
-rw-r--r--lib/private/Diagnostics/QueryLogger.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php
index 499947178a3..40d68d94ae3 100644
--- a/lib/private/Diagnostics/QueryLogger.php
+++ b/lib/private/Diagnostics/QueryLogger.php
@@ -28,15 +28,10 @@ use OC\Cache\CappedMemoryCache;
use OCP\Diagnostics\IQueryLogger;
class QueryLogger implements IQueryLogger {
- /**
- * @var \OC\Diagnostics\Query
- */
- protected $activeQuery;
-
- /**
- * @var CappedMemoryCache
- */
- protected $queries;
+ protected int $index = 0;
+ protected ?Query $activeQuery = null;
+ /** @var CappedMemoryCache<Query> */
+ protected CappedMemoryCache $queries;
/**
* QueryLogger constructor.
@@ -74,7 +69,8 @@ class QueryLogger implements IQueryLogger {
public function stopQuery() {
if ($this->activated && $this->activeQuery) {
$this->activeQuery->end(microtime(true));
- $this->queries[] = $this->activeQuery;
+ $this->queries[(string)$this->index] = $this->activeQuery;
+ $this->index++;
$this->activeQuery = null;
}
}