move resource to http worker so workers work
This commit is contained in:
parent
2efff977e0
commit
56dca6b172
|
@ -31,6 +31,13 @@ ResqueScheduler::enqueueAt(\time() + 30, 'v1-certificates', 'CertificatesV1', [
|
|||
'validateCNAME' => false,
|
||||
]);
|
||||
|
||||
$register->set('cache', function () use ($register) { // Register cache connection
|
||||
$redis = $register->get('redisPool')->get();
|
||||
$redis->setOption(Redis::OPT_READ_TIMEOUT, -1);
|
||||
|
||||
return $redis;
|
||||
}, true);
|
||||
|
||||
Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
|
||||
|
||||
$http = new Server("0.0.0.0", App::getEnv('PORT', 80));
|
||||
|
|
11
app/init.php
11
app/init.php
|
@ -165,7 +165,7 @@ $register->set('dbPool', function () { // Register DB connection
|
|||
PDONative::ATTR_ERRMODE => PDONative::ERRMODE_EXCEPTION,
|
||||
]);
|
||||
|
||||
$pool = new PDOPool($config, 4096); // TODO: Investigate pool size
|
||||
$pool = new PDOPool($config, 16384); // TODO: Investigate pool size
|
||||
|
||||
return $pool;
|
||||
});
|
||||
|
@ -226,16 +226,17 @@ $register->set('redisPool', function () {
|
|||
->withReadTimeout(0)
|
||||
->withRetryInterval(0);
|
||||
|
||||
$pool = new RedisPool($config, 4096); // TODO: Investigate pool size
|
||||
$pool = new RedisPool($config, 16384); // TODO: Investigate pool size
|
||||
|
||||
return $pool;
|
||||
});
|
||||
$register->set('cache', function () use ($register) { // Register cache connection
|
||||
$redis = $register->get('redisPool')->get();
|
||||
$register->set('cache', function () { // Register cache connection
|
||||
$redis = new Redis();
|
||||
$redis->pconnect(App::getEnv('_APP_REDIS_HOST', ''), App::getEnv('_APP_REDIS_PORT', ''));
|
||||
$redis->setOption(Redis::OPT_READ_TIMEOUT, -1);
|
||||
|
||||
return $redis;
|
||||
}, true);
|
||||
});
|
||||
$register->set('smtp', function () {
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
|
|
|
@ -5,8 +5,7 @@ require_once __DIR__ . '/init.php';
|
|||
use Appwrite\Network\Validator\Origin;
|
||||
use Appwrite\Realtime\Realtime;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Swoole\Database\RedisConfig;
|
||||
use Swoole\Database\RedisPool;
|
||||
use Swoole\Database\PDOProxy;
|
||||
use Swoole\Process;
|
||||
use Swoole\Http\Request;
|
||||
use Swoole\Http\Response as SwooleResponse;
|
||||
|
@ -36,6 +35,13 @@ $register->set('db', function () use ($register) {
|
|||
return $pdo;
|
||||
}, true);
|
||||
|
||||
$register->set('cache', function () use ($register) { // Register cache connection
|
||||
$redis = $register->get('redisPool')->get();
|
||||
$redis->setOption(Redis::OPT_READ_TIMEOUT, -1);
|
||||
|
||||
return $redis;
|
||||
}, true);
|
||||
|
||||
$server = new Server('0.0.0.0', 80);
|
||||
|
||||
$server->set([
|
||||
|
|
Loading…
Reference in a new issue