From e3b323d2a71c432b7a3cf29613e7f7346274af1f Mon Sep 17 00:00:00 2001 From: weigang Date: Fri, 7 Aug 2020 12:06:12 +0800 Subject: [PATCH] =?UTF-8?q?SSDB=20Task=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit e5ead242086db660d887f340c169a222d7c1a94d) --- app/Libs/SimpleSSDB.php | 2 +- app/TaskWorker/SSDBTask.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Libs/SimpleSSDB.php b/app/Libs/SimpleSSDB.php index b6920b2..c829bda 100644 --- a/app/Libs/SimpleSSDB.php +++ b/app/Libs/SimpleSSDB.php @@ -78,7 +78,7 @@ class SSDB function __construct($host, $port, $timeout_ms=2000){ $timeout_f = (float)$timeout_ms/1000; - $this->sock = @stream_socket_client("[$host]:$port", $errno, $errstr, $timeout_f); + $this->sock = @stream_socket_client("$host:$port", $errno, $errstr, $timeout_f); if(!$this->sock){ throw new SSDBException("$errno: $errstr"); } diff --git a/app/TaskWorker/SSDBTask.php b/app/TaskWorker/SSDBTask.php index 9c6ef29..fd4d451 100644 --- a/app/TaskWorker/SSDBTask.php +++ b/app/TaskWorker/SSDBTask.php @@ -24,6 +24,13 @@ class SSDBTask return $result; } + public function execWithoutTask($method,...$args) + { + $result = $this->client()->__call($method,$args); + + return $result; + } + protected function client(){ if ($this->ss instanceof SimpleSSDB) { return $this->ss;