comparing $workersCount via worker.php vs init php
This commit is contained in:
parent
94178f8eaf
commit
0c776e0a44
2
.env
2
.env
|
@ -1,8 +1,6 @@
|
|||
_APP_ENV=development
|
||||
_APP_LOCALE=en
|
||||
_APP_WORKER_PER_CORE=6
|
||||
_APP_WORKERS_NUM=1
|
||||
_APP_QUEUE_NAME=database_db_main
|
||||
_APP_CONSOLE_WHITELIST_ROOT=disabled
|
||||
_APP_CONSOLE_WHITELIST_EMAILS=
|
||||
_APP_CONSOLE_WHITELIST_IPS=
|
||||
|
|
|
@ -221,10 +221,17 @@ if (!isset($args[1])) {
|
|||
$workerName = $args[0];
|
||||
$workerIndex = $args[1] ?? '';
|
||||
|
||||
if (!empty($workerNum)) {
|
||||
if (!empty($workerIndex)) {
|
||||
$workerName .= '_' . $workerIndex;
|
||||
}
|
||||
|
||||
$multiprocessing = App::getEnv('_APP_SERVER_MULTIPROCESS', 'disabled') === 'enabled';
|
||||
if ($multiprocessing) {
|
||||
$workerCount = swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6));
|
||||
} else {
|
||||
$workerCount = 1;
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* Any worker can be configured with the following env vars:
|
||||
|
@ -233,7 +240,7 @@ try {
|
|||
* - _APP_QUEUE_NAME The name of the queue to read for database events
|
||||
*/
|
||||
$platform->init(Service::TYPE_WORKER, [
|
||||
'workersNum' => App::getEnv('_APP_WORKERS_NUM', swoole_cpu_num() * intval(App::getEnv('_APP_WORKER_PER_CORE', 6))),
|
||||
'workerCount' => $workerCount,
|
||||
'connection' => $pools->get('queue')->pop()->getResource(),
|
||||
'workerName' => strtolower($workerName) ?? null,
|
||||
'queueName' => App::getEnv('_APP_QUEUE_NAME', 'v1-' . strtolower($workerName))
|
||||
|
|
|
@ -389,8 +389,8 @@ services:
|
|||
- _APP_DB_PASS
|
||||
- _APP_LOGGING_PROVIDER
|
||||
- _APP_LOGGING_CONFIG
|
||||
- _APP_WORKERS_NUM
|
||||
- _APP_QUEUE_NAME
|
||||
- _APP_SERVER_MULTIPROCESS=disabled
|
||||
- _APP_QUEUE_NAME=database_db_main
|
||||
|
||||
appwrite-worker-builds:
|
||||
entrypoint: worker-builds
|
||||
|
|
Loading…
Reference in a new issue