1
0
Fork 0
mirror of synced 2024-06-02 10:54:44 +12:00

replace influx with redis cache in worker init

This commit is contained in:
Torsten Dittmann 2021-03-24 13:25:28 +01:00
parent 6b5718f32f
commit 78ec3a7821

View file

@ -170,6 +170,18 @@ $register->set('redisPool', function () {
return $pool;
});
$register->set('influxdb', function () { // Register DB connection
$host = App::getEnv('_APP_INFLUXDB_HOST', '');
$port = App::getEnv('_APP_INFLUXDB_PORT', '');
if (empty($host) || empty($port)) {
return;
}
$client = new InfluxDB\Client($host, $port, '', '', false, false, 5);
return $client;
});
$register->set('statsd', function () { // Register DB connection
$host = App::getEnv('_APP_STATSD_HOST', 'telegraf');
$port = App::getEnv('_APP_STATSD_PORT', 8125);
@ -179,13 +191,6 @@ $register->set('statsd', function () { // Register DB connection
return $statsd;
});
$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;
});
$register->set('smtp', function () {
$mail = new PHPMailer(true);