From deb3dadbe45a7ba70d7408668edf6ecb10399896 Mon Sep 17 00:00:00 2001 From: dongwei <838456736@qq.com> Date: Wed, 13 Mar 2019 16:15:07 +0800 Subject: [PATCH] fix bug --- src/Providers/ClientServiceProvider.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Providers/ClientServiceProvider.php b/src/Providers/ClientServiceProvider.php index 6d59715..313872d 100644 --- a/src/Providers/ClientServiceProvider.php +++ b/src/Providers/ClientServiceProvider.php @@ -21,14 +21,13 @@ class ClientServiceProvider extends BaseServiceProvider if (!is_array($config)) { throw new RpcServerException("Application's Rpc Client Config Undefind", 500); } - $client = new Client($config); - $this->app->singleton('rpc', function () use ($client) { - return $client; + $this->app->singleton('rpc', function () use ($config) { + return new Client($config); }); foreach ($config['client'] as $k => $item) { - $this->app->singleton('rpc.' . $k, function () use ($k, $client) { - return $client->endpoint($k); + $this->app->singleton('rpc.' . $k, function () use ($k, $config) { + return (new Client($config))->endpoint($k); }); } }