some fixes
This commit is contained in:
parent
1036cb406d
commit
593e5ab316
10 changed files with 34 additions and 16 deletions
|
@ -2854,7 +2854,7 @@ App::put('/v1/account/verification')
|
||||||
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
$dbForProject->deleteCachedDocument('users', $profile->getId());
|
||||||
|
|
||||||
$queueForEvents
|
$queueForEvents
|
||||||
->setParam('userId', $user->getId())
|
->setParam('userId', $userId)
|
||||||
->setParam('tokenId', $verificationDocument->getId())
|
->setParam('tokenId', $verificationDocument->getId())
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ Server::setResource('dbForConsole', function (Cache $cache, Registry $register)
|
||||||
$database = $pools
|
$database = $pools
|
||||||
->get('console')
|
->get('console')
|
||||||
->pop()
|
->pop()
|
||||||
->getResource();
|
->getResource()
|
||||||
|
;
|
||||||
|
|
||||||
$adapter = new Database($database, $cache);
|
$adapter = new Database($database, $cache);
|
||||||
$adapter->setNamespace('_console');
|
$adapter->setNamespace('_console');
|
||||||
|
@ -64,9 +65,10 @@ Server::setResource('dbForProject', function (Cache $cache, Registry $register,
|
||||||
$database = $pools
|
$database = $pools
|
||||||
->get($project->getAttribute('database'))
|
->get($project->getAttribute('database'))
|
||||||
->pop()
|
->pop()
|
||||||
->getResource();
|
->getResource()
|
||||||
|
;
|
||||||
|
|
||||||
$adapter = new Database($database, $cache);
|
$adapter = new Database($database, $cache);
|
||||||
$adapter->setNamespace('_' . $project->getInternalId());
|
$adapter->setNamespace('_' . $project->getInternalId());
|
||||||
return $adapter;
|
return $adapter;
|
||||||
}, ['cache', 'register', 'message', 'dbForConsole']);
|
}, ['cache', 'register', 'message', 'dbForConsole']);
|
||||||
|
@ -111,7 +113,8 @@ Server::setResource('cache', function (Registry $register) {
|
||||||
$adapters[] = $pools
|
$adapters[] = $pools
|
||||||
->get($value)
|
->get($value)
|
||||||
->pop()
|
->pop()
|
||||||
->getResource();
|
->getResource()
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Cache(new Sharding($adapters));
|
return new Cache(new Sharding($adapters));
|
||||||
|
|
|
@ -114,8 +114,6 @@ class Build extends Event
|
||||||
{
|
{
|
||||||
$client = new Client($this->queue, $this->connection);
|
$client = new Client($this->queue, $this->connection);
|
||||||
|
|
||||||
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
|
|
||||||
|
|
||||||
return $client->enqueue([
|
return $client->enqueue([
|
||||||
'project' => $this->project,
|
'project' => $this->project,
|
||||||
'resource' => $this->resource,
|
'resource' => $this->resource,
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Appwrite\Event;
|
namespace Appwrite\Event;
|
||||||
|
|
||||||
use Utopia\App;
|
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
use Utopia\Queue\Client;
|
use Utopia\Queue\Client;
|
||||||
use Utopia\Queue\Connection;
|
use Utopia\Queue\Connection;
|
||||||
|
|
|
@ -128,8 +128,6 @@ class Delete extends Event
|
||||||
{
|
{
|
||||||
$client = new Client($this->queue, $this->connection);
|
$client = new Client($this->queue, $this->connection);
|
||||||
|
|
||||||
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
|
|
||||||
|
|
||||||
return $client->enqueue([
|
return $client->enqueue([
|
||||||
'project' => $this->project,
|
'project' => $this->project,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
|
|
|
@ -50,6 +50,7 @@ class Event
|
||||||
protected array $context = [];
|
protected array $context = [];
|
||||||
protected ?Document $project = null;
|
protected ?Document $project = null;
|
||||||
protected ?Document $user = null;
|
protected ?Document $user = null;
|
||||||
|
protected bool $paused = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Connection $connection
|
* @param Connection $connection
|
||||||
|
@ -264,6 +265,9 @@ class Event
|
||||||
*/
|
*/
|
||||||
public function trigger(): string|bool
|
public function trigger(): string|bool
|
||||||
{
|
{
|
||||||
|
if ($this->paused) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$client = new Client($this->queue, $this->connection);
|
$client = new Client($this->queue, $this->connection);
|
||||||
|
|
||||||
|
@ -472,4 +476,22 @@ class Event
|
||||||
*/
|
*/
|
||||||
return \array_values($events);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,10 @@ class Func extends Event
|
||||||
*/
|
*/
|
||||||
public function trigger(): string|bool
|
public function trigger(): string|bool
|
||||||
{
|
{
|
||||||
|
if ($this->paused) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$client = new Client($this->queue, $this->connection);
|
$client = new Client($this->queue, $this->connection);
|
||||||
|
|
||||||
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
|
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace Appwrite\Event;
|
namespace Appwrite\Event;
|
||||||
|
|
||||||
use Utopia\Database\Document;
|
|
||||||
use Utopia\Queue\Client;
|
use Utopia\Queue\Client;
|
||||||
use Utopia\Queue\Connection;
|
use Utopia\Queue\Connection;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
namespace Appwrite\Event;
|
namespace Appwrite\Event;
|
||||||
|
|
||||||
use DateTime;
|
|
||||||
use Resque;
|
|
||||||
use ResqueScheduler;
|
|
||||||
use Utopia\Database\Document;
|
use Utopia\Database\Document;
|
||||||
use Utopia\Queue\Client;
|
use Utopia\Queue\Client;
|
||||||
use Utopia\Queue\Connection;
|
use Utopia\Queue\Connection;
|
||||||
|
|
|
@ -75,8 +75,6 @@ class Phone extends Event
|
||||||
{
|
{
|
||||||
$client = new Client($this->queue, $this->connection);
|
$client = new Client($this->queue, $this->connection);
|
||||||
|
|
||||||
$events = $this->getEvent() ? Event::generateEvents($this->getEvent(), $this->getParams()) : null;
|
|
||||||
|
|
||||||
return $client->enqueue([
|
return $client->enqueue([
|
||||||
'project' => $this->project,
|
'project' => $this->project,
|
||||||
'user' => $this->user,
|
'user' => $this->user,
|
||||||
|
|
Loading…
Reference in a new issue