moved reduce after delete document to usage-worker
This commit is contained in:
parent
4198cbfca5
commit
db8b24ee22
1 changed files with 6 additions and 1 deletions
|
@ -69,12 +69,17 @@ Server::setResource('reduce', function (Cache $cache, Registry $register, $pools
|
||||||
case str_starts_with($document->getCollection(), 'database_') && !str_contains($document->getCollection(), 'collection'): //collections
|
case str_starts_with($document->getCollection(), 'database_') && !str_contains($document->getCollection(), 'collection'): //collections
|
||||||
$parts = explode('_', $document->getCollection());
|
$parts = explode('_', $document->getCollection());
|
||||||
$databaseId = $parts[1] ?? 0;
|
$databaseId = $parts[1] ?? 0;
|
||||||
$documents = $dbForProject->getDocument('stats', md5("_inf_" . "{$databaseId}" . ".documents"));
|
$documents = $dbForProject->getDocument('stats', md5("_inf_" . "{$databaseId}" . "." . "{$document->getInternalId()}" . ".documents"));
|
||||||
|
|
||||||
if (!empty($documents['value'])) {
|
if (!empty($documents['value'])) {
|
||||||
$metrics[] = [
|
$metrics[] = [
|
||||||
'key' => 'documents',
|
'key' => 'documents',
|
||||||
'value' => ($documents['value'] * -1),
|
'value' => ($documents['value'] * -1),
|
||||||
];
|
];
|
||||||
|
$metrics[] = [
|
||||||
|
'key' => "{$databaseId}" . ".documents",
|
||||||
|
'value' => ($documents['value'] * -1),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue