mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
fix: db queues
This commit is contained in:
parent
918912c0b9
commit
39a190f60c
2 changed files with 12 additions and 9 deletions
|
|
@ -538,7 +538,7 @@ App::get('/v1/health/queue/databases')
|
|||
->inject('response')
|
||||
->action(function (string $name, int|string $threshold, Database $queueForDatabase, Response $response) {
|
||||
$threshold = \intval($threshold);
|
||||
$size = $queueForDatabase->getSize();
|
||||
$size = $queueForDatabase->setQueue($name)->getSize();
|
||||
|
||||
if ($size >= $threshold) {
|
||||
throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}.");
|
||||
|
|
|
|||
|
|
@ -161,17 +161,20 @@ class Database extends Event
|
|||
return $this->document;
|
||||
}
|
||||
|
||||
public function getQueue(): string
|
||||
public function setProject(Document $project): self
|
||||
{
|
||||
try {
|
||||
$dsn = new DSN($this->getProject()->getAttribute('database'));
|
||||
} catch (\InvalidArgumentException) {
|
||||
// TODO: Temporary until all projects are using shared tables
|
||||
$dsn = new DSN('mysql://' . $this->getProject()->getAttribute('database'));
|
||||
$database = $project->getAttribute('database');
|
||||
if (!empty($database)) {
|
||||
try {
|
||||
$dsn = new DSN($database);
|
||||
} catch (\InvalidArgumentException) {
|
||||
// TODO: Temporary until all projects are using shared tables
|
||||
$dsn = new DSN("mysql://$database");
|
||||
}
|
||||
$this->queue = $dsn->getHost();
|
||||
}
|
||||
|
||||
$this->queue = $dsn->getHost();
|
||||
return $this->queue;
|
||||
return parent::setProject($project);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue