feat: update deletes,usage and functions worker
This commit is contained in:
parent
da4655df32
commit
a93e8f3b0b
3 changed files with 8 additions and 8 deletions
|
@ -370,7 +370,7 @@ $cli
|
|||
|
||||
// Get total storage
|
||||
$dbForProject->setNamespace('_project_' . $projectId);
|
||||
$storageTotal = $dbForProject->sum('files', 'sizeOriginal') + $dbForProject->sum('tags', 'size');
|
||||
$storageTotal = $dbForProject->sum('files', 'sizeOriginal') + $dbForProject->sum('deployments', 'size');
|
||||
|
||||
$time = (int) (floor(time() / 1800) * 1800); // Time rounded to nearest 30 minutes
|
||||
$id = \md5($time . '_30m_storage.total'); //Construct unique id for each metric using time, period and metric
|
||||
|
|
|
@ -309,15 +309,15 @@ class DeletesV1 extends Worker
|
|||
$dbForProject = $this->getProjectDB($projectId);
|
||||
$device = new Local(APP_STORAGE_FUNCTIONS . '/app-' . $projectId);
|
||||
|
||||
// Delete Tags
|
||||
$this->deleteByGroup('tags', [
|
||||
// Delete Deployments
|
||||
$this->deleteByGroup('deployments', [
|
||||
new Query('functionId', Query::TYPE_EQUAL, [$document->getId()])
|
||||
], $dbForProject, function (Document $document) use ($device) {
|
||||
|
||||
if ($device->delete($document->getAttribute('path', ''))) {
|
||||
Console::success('Delete code tag: ' . $document->getAttribute('path', ''));
|
||||
Console::success('Delete code deployment: ' . $document->getAttribute('path', ''));
|
||||
} else {
|
||||
Console::error('Failed to delete code tag: ' . $document->getAttribute('path', ''));
|
||||
Console::error('Failed to delete code deployment: ' . $document->getAttribute('path', ''));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -126,11 +126,11 @@ class FunctionsV1 extends Worker
|
|||
|
||||
foreach ($functions as $function) {
|
||||
$events = $function->getAttribute('events', []);
|
||||
$tag = $function->getAttribute('tag', []);
|
||||
$deployment = $function->getAttribute('deployment', []);
|
||||
|
||||
Console::success('Itterating function: ' . $function->getAttribute('name'));
|
||||
|
||||
if (!\in_array($event, $events) || empty($tag)) {
|
||||
if (!\in_array($event, $events) || empty($deployment)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ class FunctionsV1 extends Worker
|
|||
}
|
||||
|
||||
/**
|
||||
* Execute function tag
|
||||
* Execute function deployment
|
||||
*
|
||||
* @param string $trigger
|
||||
* @param string $projectId
|
||||
|
|
Loading…
Reference in a new issue