1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00

some fixes

This commit is contained in:
shimon 2023-10-17 22:08:01 +03:00
parent 1036cb406d
commit 593e5ab316
10 changed files with 34 additions and 16 deletions

View file

@ -2854,7 +2854,7 @@ App::put('/v1/account/verification')
$dbForProject->deleteCachedDocument('users', $profile->getId());
$queueForEvents
->setParam('userId', $user->getId())
->setParam('userId', $userId)
->setParam('tokenId', $verificationDocument->getId())
;

View file

@ -44,7 +44,8 @@ Server::setResource('dbForConsole', function (Cache $cache, Registry $register)
$database = $pools
->get('console')
->pop()
->getResource();
->getResource()
;
$adapter = new Database($database, $cache);
$adapter->setNamespace('_console');
@ -64,9 +65,10 @@ Server::setResource('dbForProject', function (Cache $cache, Registry $register,
$database = $pools
->get($project->getAttribute('database'))
->pop()
->getResource();
->getResource()
;
$adapter = new Database($database, $cache);
$adapter = new Database($database, $cache);
$adapter->setNamespace('_' . $project->getInternalId());
return $adapter;
}, ['cache', 'register', 'message', 'dbForConsole']);
@ -111,7 +113,8 @@ Server::setResource('cache', function (Registry $register) {
$adapters[] = $pools
->get($value)
->pop()
->getResource();
->getResource()
;
}
return new Cache(new Sharding($adapters));

View file

@ -114,8 +114,6 @@ class Build extends Event
{
$client = new Client($this->queue, $this->connection);
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
return $client->enqueue([
'project' => $this->project,
'resource' => $this->resource,

View file

@ -2,7 +2,6 @@
namespace Appwrite\Event;
use Utopia\App;
use Utopia\Database\Document;
use Utopia\Queue\Client;
use Utopia\Queue\Connection;

View file

@ -128,8 +128,6 @@ class Delete extends Event
{
$client = new Client($this->queue, $this->connection);
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
return $client->enqueue([
'project' => $this->project,
'type' => $this->type,

View file

@ -50,6 +50,7 @@ class Event
protected array $context = [];
protected ?Document $project = null;
protected ?Document $user = null;
protected bool $paused = false;
/**
* @param Connection $connection
@ -264,6 +265,9 @@ class Event
*/
public function trigger(): string|bool
{
if ($this->paused) {
return false;
}
$client = new Client($this->queue, $this->connection);
@ -472,4 +476,22 @@ class Event
*/
return \array_values($events);
}
/**
* Get the value of paused
*/
public function isPaused(): bool
{
return $this->paused;
}
/**
* Set the value of paused
*/
public function setPaused(bool $paused): self
{
$this->paused = $paused;
return $this;
}
}

View file

@ -188,6 +188,10 @@ class Func extends Event
*/
public function trigger(): string|bool
{
if ($this->paused) {
return false;
}
$client = new Client($this->queue, $this->connection);
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;

View file

@ -2,7 +2,6 @@
namespace Appwrite\Event;
use Utopia\Database\Document;
use Utopia\Queue\Client;
use Utopia\Queue\Connection;

View file

@ -2,9 +2,6 @@
namespace Appwrite\Event;
use DateTime;
use Resque;
use ResqueScheduler;
use Utopia\Database\Document;
use Utopia\Queue\Client;
use Utopia\Queue\Connection;

View file

@ -75,8 +75,6 @@ class Phone extends Event
{
$client = new Client($this->queue, $this->connection);
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
return $client->enqueue([
'project' => $this->project,
'user' => $this->user,