forked from appwrite/appwrite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b31c76
commit 216a5d7
Showing
7 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
php /usr/src/code/app/cli.php queue-count-failed $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
php /usr/src/code/app/cli.php queue-count-processing $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
php /usr/src/code/app/cli.php queue-count-success $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Appwrite\Platform\Tasks; | ||
|
||
use Appwrite\Event\Event; | ||
use Utopia\CLI\Console; | ||
use Utopia\Platform\Action; | ||
use Utopia\Queue\Client; | ||
use Utopia\Queue\Connection; | ||
use Utopia\Validator\WhiteList; | ||
|
||
class QueueCountFailed extends Action | ||
{ | ||
public static function getName(): string | ||
{ | ||
return 'queue-count-failed'; | ||
} | ||
|
||
|
||
public function __construct() | ||
{ | ||
$this | ||
->desc('Return the number of failed jobs from a specific queue identified by the name parameter') | ||
->param('name', '', new WhiteList([ | ||
Event::DATABASE_QUEUE_NAME, | ||
Event::DELETE_QUEUE_NAME, | ||
Event::AUDITS_QUEUE_NAME, | ||
Event::MAILS_QUEUE_NAME, | ||
Event::FUNCTIONS_QUEUE_NAME, | ||
Event::USAGE_QUEUE_NAME, | ||
Event::WEBHOOK_CLASS_NAME, | ||
Event::CERTIFICATES_QUEUE_NAME, | ||
Event::BUILDS_QUEUE_NAME, | ||
Event::MESSAGING_QUEUE_NAME, | ||
Event::MIGRATIONS_QUEUE_NAME, | ||
Event::HAMSTER_CLASS_NAME | ||
]), 'Queue name') | ||
->inject('queue') | ||
->callback(fn ($name, $queue) => $this->action($name, $queue)); | ||
} | ||
|
||
/** | ||
* @param string $name The name of the queue to count the failed jobs from | ||
* @param Connection $queue | ||
*/ | ||
public function action(string $name, Connection $queue): void | ||
{ | ||
if (!$name) { | ||
Console::error('Missing required parameter $name'); | ||
return; | ||
} | ||
|
||
$queueClient = new Client($name, $queue); | ||
|
||
Console::log("Queue: '".$name."' Currently has " . $queueClient->countFailedJobs() . " failed jobs."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Appwrite\Platform\Tasks; | ||
|
||
use Appwrite\Event\Event; | ||
use Utopia\CLI\Console; | ||
use Utopia\Platform\Action; | ||
use Utopia\Queue\Client; | ||
use Utopia\Queue\Connection; | ||
use Utopia\Validator\WhiteList; | ||
|
||
class QueueCountProcessing extends Action | ||
{ | ||
public static function getName(): string | ||
{ | ||
return 'queue-count-processing'; | ||
} | ||
|
||
|
||
public function __construct() | ||
{ | ||
$this | ||
->desc('Return the number of currently processing jobs from a specific queue identified by the name parameter') | ||
->param('name', '', new WhiteList([ | ||
Event::DATABASE_QUEUE_NAME, | ||
Event::DELETE_QUEUE_NAME, | ||
Event::AUDITS_QUEUE_NAME, | ||
Event::MAILS_QUEUE_NAME, | ||
Event::FUNCTIONS_QUEUE_NAME, | ||
Event::USAGE_QUEUE_NAME, | ||
Event::WEBHOOK_CLASS_NAME, | ||
Event::CERTIFICATES_QUEUE_NAME, | ||
Event::BUILDS_QUEUE_NAME, | ||
Event::MESSAGING_QUEUE_NAME, | ||
Event::MIGRATIONS_QUEUE_NAME, | ||
Event::HAMSTER_CLASS_NAME | ||
]), 'Queue name') | ||
->inject('queue') | ||
->callback(fn ($name, $queue) => $this->action($name, $queue)); | ||
} | ||
|
||
/** | ||
* @param string $name The name of the queue to count the processing jobs from | ||
* @param Connection $queue | ||
*/ | ||
public function action(string $name, Connection $queue): void | ||
{ | ||
if (!$name) { | ||
Console::error('Missing required parameter $name'); | ||
return; | ||
} | ||
|
||
$queueClient = new Client($name, $queue); | ||
|
||
Console::log("Queue: '".$name."' Currently has " . $queueClient->countProcessingJobs() . " processing jobs."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Appwrite\Platform\Tasks; | ||
|
||
use Appwrite\Event\Event; | ||
use Utopia\CLI\Console; | ||
use Utopia\Platform\Action; | ||
use Utopia\Queue\Client; | ||
use Utopia\Queue\Connection; | ||
use Utopia\Validator\WhiteList; | ||
|
||
class QueueCountSuccess extends Action | ||
{ | ||
public static function getName(): string | ||
{ | ||
return 'queue-count-success'; | ||
} | ||
|
||
|
||
public function __construct() | ||
{ | ||
$this | ||
->desc('Return the number of successful jobs from a specific queue identified by the name parameter') | ||
->param('name', '', new WhiteList([ | ||
Event::DATABASE_QUEUE_NAME, | ||
Event::DELETE_QUEUE_NAME, | ||
Event::AUDITS_QUEUE_NAME, | ||
Event::MAILS_QUEUE_NAME, | ||
Event::FUNCTIONS_QUEUE_NAME, | ||
Event::USAGE_QUEUE_NAME, | ||
Event::WEBHOOK_CLASS_NAME, | ||
Event::CERTIFICATES_QUEUE_NAME, | ||
Event::BUILDS_QUEUE_NAME, | ||
Event::MESSAGING_QUEUE_NAME, | ||
Event::MIGRATIONS_QUEUE_NAME, | ||
Event::HAMSTER_CLASS_NAME | ||
]), 'Queue name') | ||
->inject('queue') | ||
->callback(fn ($name, $queue) => $this->action($name, $queue)); | ||
} | ||
|
||
/** | ||
* @param string $name The name of the queue to count the successful jobs from | ||
* @param Connection $queue | ||
*/ | ||
public function action(string $name, Connection $queue): void | ||
{ | ||
if (!$name) { | ||
Console::error('Missing required parameter $name'); | ||
return; | ||
} | ||
|
||
$queueClient = new Client($name, $queue); | ||
|
||
Console::log("Queue: '".$name."' Currently has " . $queueClient->countSuccessfulJobs() . " success jobs."); | ||
} | ||
} |