mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fix ID not changed per handleDatabase iteration
This commit is contained in:
Generated
+8
-61
@@ -5601,70 +5601,18 @@
|
||||
},
|
||||
"time": "2023-10-30T13:38:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpbench/dom",
|
||||
"version": "0.3.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpbench/dom.git",
|
||||
"reference": "786a96db538d0def931f5b19225233ec42ec7a72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpbench/dom/zipball/786a96db538d0def931f5b19225233ec42ec7a72",
|
||||
"reference": "786a96db538d0def931f5b19225233ec42ec7a72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"php": "^7.3||^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.14",
|
||||
"phpstan/phpstan": "^1.10",
|
||||
"phpunit/phpunit": "^8.0||^9.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpBench\\Dom\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Daniel Leech",
|
||||
"email": "daniel@dantleech.com"
|
||||
}
|
||||
],
|
||||
"description": "DOM wrapper to simplify working with the PHP DOM implementation",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpbench/dom/issues",
|
||||
"source": "https://github.com/phpbench/dom/tree/0.3.3"
|
||||
},
|
||||
"abandoned": true,
|
||||
"time": "2023-03-06T23:46:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpbench/phpbench",
|
||||
"version": "1.3.1",
|
||||
"version": "1.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpbench/phpbench.git",
|
||||
"reference": "a3e1ef08d9d7736d43a7fbd444893d6a073c0ca0"
|
||||
"reference": "4248817222514421cba466bfa7adc7d8932345d4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpbench/phpbench/zipball/a3e1ef08d9d7736d43a7fbd444893d6a073c0ca0",
|
||||
"reference": "a3e1ef08d9d7736d43a7fbd444893d6a073c0ca0",
|
||||
"url": "https://api.github.com/repos/phpbench/phpbench/zipball/4248817222514421cba466bfa7adc7d8932345d4",
|
||||
"reference": "4248817222514421cba466bfa7adc7d8932345d4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5677,7 +5625,6 @@
|
||||
"ext-tokenizer": "*",
|
||||
"php": "^8.1",
|
||||
"phpbench/container": "^2.2",
|
||||
"phpbench/dom": "~0.3.3",
|
||||
"psr/log": "^1.1 || ^2.0 || ^3.0",
|
||||
"seld/jsonlint": "^1.1",
|
||||
"symfony/console": "^6.1 || ^7.0",
|
||||
@@ -5696,8 +5643,8 @@
|
||||
"phpstan/extension-installer": "^1.1",
|
||||
"phpstan/phpstan": "^1.0",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"phpunit/phpunit": "^10.4",
|
||||
"rector/rector": "^0.18.11 || ^1.0.0",
|
||||
"phpunit/phpunit": "^10.4 || ^11.0",
|
||||
"rector/rector": "^1.2",
|
||||
"symfony/error-handler": "^6.1 || ^7.0",
|
||||
"symfony/var-dumper": "^6.1 || ^7.0"
|
||||
},
|
||||
@@ -5742,7 +5689,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpbench/phpbench/issues",
|
||||
"source": "https://github.com/phpbench/phpbench/tree/1.3.1"
|
||||
"source": "https://github.com/phpbench/phpbench/tree/1.4.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -5750,7 +5697,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-30T11:04:37+00:00"
|
||||
"time": "2025-01-26T19:54:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
|
||||
@@ -85,17 +85,22 @@ class UsageDump extends Action
|
||||
|
||||
if (\str_contains($key, METRIC_DATABASES_STORAGE)) {
|
||||
static::handleDatabaseStorage(
|
||||
$id,
|
||||
$projectDocuments,
|
||||
$key,
|
||||
$time,
|
||||
$period,
|
||||
$dbForProject,
|
||||
$projectDocuments,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
static::addStatsDocument($projectDocuments, $id, $period, $time, $key, $value);
|
||||
static::addStatsDocument(
|
||||
$projectDocuments,
|
||||
$period,
|
||||
$time,
|
||||
$key,
|
||||
$value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,20 +126,22 @@ class UsageDump extends Action
|
||||
}
|
||||
|
||||
private static function handleDatabaseStorage(
|
||||
string $id,
|
||||
array &$projectDocuments,
|
||||
string $key,
|
||||
?string $time,
|
||||
string $period,
|
||||
Database $dbForProject,
|
||||
array &$projectDocuments,
|
||||
): void {
|
||||
$data = \explode('.', $key);
|
||||
$value = 0;
|
||||
$unique = static::getUniqueKey($key, $period, $time);
|
||||
|
||||
Console::info("[PROCESSING] {$unique}");
|
||||
|
||||
if (isset(static::$seenMetrics[$unique])) {
|
||||
Console::log("[DUPLICATE CALL] handleDatabaseStorage() called twice for: {$unique}");
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
return;
|
||||
}
|
||||
|
||||
static::$seenMetrics[$unique] = true;
|
||||
@@ -183,7 +190,13 @@ class UsageDump extends Action
|
||||
\var_dump('[PROCESSING COLLECTION KEYS] ' . \json_encode($keys));
|
||||
|
||||
foreach ($keys as $metric) {
|
||||
static::addStatsDocument($projectDocuments, $id, $period, $time, $metric, $diff);
|
||||
static::addStatsDocument(
|
||||
$projectDocuments,
|
||||
$period,
|
||||
$time,
|
||||
$metric,
|
||||
$diff
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -235,7 +248,13 @@ class UsageDump extends Action
|
||||
\var_dump('[PROCESSING DATABASE KEYS] ' . \json_encode($keys));
|
||||
|
||||
foreach ($keys as $metric) {
|
||||
static::addStatsDocument($projectDocuments, $id, $period, $time, $metric, $diff);
|
||||
static::addStatsDocument(
|
||||
$projectDocuments,
|
||||
$period,
|
||||
$time,
|
||||
$metric,
|
||||
$diff
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -305,7 +324,13 @@ class UsageDump extends Action
|
||||
\var_dump('[PROCESSING PROJECT KEYS] ' . \json_encode($keys));
|
||||
|
||||
foreach ($keys as $metric) {
|
||||
static::addStatsDocument($projectDocuments, $id, $period, $time, $metric, $diff);
|
||||
static::addStatsDocument(
|
||||
$projectDocuments,
|
||||
$period,
|
||||
$time,
|
||||
$metric,
|
||||
$diff
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -314,26 +339,25 @@ class UsageDump extends Action
|
||||
|
||||
private static function addStatsDocument(
|
||||
array &$projectDocuments,
|
||||
string $id,
|
||||
string $period,
|
||||
?string $time,
|
||||
string $key,
|
||||
int $diff
|
||||
): void {
|
||||
$unique = static::getUniqueKey($key, $period, $time);
|
||||
$id = \md5("{$time}_{$period}_{$key}");
|
||||
|
||||
if (isset($projectDocuments[$unique])) {
|
||||
Console::log("[DUPLICATE DETECTED] Metric: {$unique} (Incrementing by {$diff})");
|
||||
Console::log("Previous Value: " . $projectDocuments[$unique]['value']);
|
||||
\debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
// if (isset($projectDocuments[$unique])) {
|
||||
// Console::log("[DUPLICATE DETECTED] Metric: {$unique} (Incrementing by {$diff})");
|
||||
// Console::log("Previous Value: " . $projectDocuments[$unique]['value']);
|
||||
// \debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||
//
|
||||
// $projectDocuments[$unique]['value'] += $diff;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// Console::log("[ADDING] New metric: {$unique} (Value: {$diff})");
|
||||
|
||||
$projectDocuments[$unique]['value'] += $diff;
|
||||
return;
|
||||
}
|
||||
|
||||
Console::log("[ADDING] New metric: {$unique} (Value: {$diff})");
|
||||
|
||||
$projectDocuments[$unique] = new Document([
|
||||
$projectDocuments[] = new Document([
|
||||
'$id' => $id,
|
||||
'period' => $period,
|
||||
'time' => $time,
|
||||
|
||||
Reference in New Issue
Block a user