From 78ec3a7821b6868d3b3d2f3e1bec412ceef9f495 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 24 Mar 2021 13:25:28 +0100 Subject: [PATCH] replace influx with redis cache in worker init --- app/init.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/init.php b/app/init.php index f272c3905f..c2b8d85d0f 100644 --- a/app/init.php +++ b/app/init.php @@ -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);