@@ -28,7 +28,7 @@ class Subscriber
2828 * 超时
2929 * @var float
3030 */
31- public $ timeout =0 .0 ;
31+ public $ timeout =10 .0 ;
3232
3333/**
3434 * 密码
@@ -55,25 +55,23 @@ class Subscriber
5555 * @param string $password
5656 * @param float $timeout
5757 * @throws \Swoole\Exception
58- * @throws \Throwable
5958 */
60- public function __construct (string $ host ,int $ port ,string $ password ='' ,float $ timeout =5 .0 )
59+ public function __construct (string $ host ,int $ port = 6379 ,string $ password ='' ,float $ timeout =10 .0 )
6160 {
62- $ this ->host =$ host ;
63- $ this ->port =$ port ;
61+ $ this ->host =$ host ;
62+ $ this ->port =$ port ;
6463$ this ->password =$ password ;
65- $ this ->timeout =$ timeout ;
64+ $ this ->timeout =$ timeout ;
6665$ this ->connect ();
6766 }
6867
6968/**
7069 * Connect
7170 * @throws \Swoole\Exception
72- * @throws \Throwable
7371 */
7472protected function connect ()
7573 {
76- $ connection =new Connection ($ this ->host ,$ this ->port ,$ this ->timeout );
74+ $ connection =new Connection ($ this ->host ,$ this ->port ,$ this ->timeout );
7775$ this ->commandInvoker =new CommandInvoker ($ connection );
7876if ('' != (string )$ this ->password ) {
7977$ this ->commandInvoker ->invoke ("auth {$ this ->password }" ,1 );