From 1bcb8a010abbec66f60819975578930e1c67eee3 Mon Sep 17 00:00:00 2001 From: dongwei <838456736@qq.com> Date: Fri, 11 Jan 2019 16:59:21 +0800 Subject: [PATCH] request -id --- src/Client.php | 6 ++---- src/Providers/ClientServiceProvider.php | 4 ---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Client.php b/src/Client.php index b51aa65..be1dad9 100644 --- a/src/Client.php +++ b/src/Client.php @@ -31,8 +31,7 @@ class Client $stream->setFormatter(new $this->config['log_formatter']()); $logger = new Logger('RPC.LOGGER'); $logger->pushHandler($stream); - $logger->info('call client rpc'); - $this->id = 0; + $this->id = app('request')->header('X-Request-Id')?:"no-x-request-id"; $this->logger = $logger; } @@ -114,8 +113,7 @@ class Client */ protected function id() { - $this->id++; - return $this->id; + return $this->id.'-'.time(); } } \ No newline at end of file diff --git a/src/Providers/ClientServiceProvider.php b/src/Providers/ClientServiceProvider.php index ef4a624..0c58e3b 100644 --- a/src/Providers/ClientServiceProvider.php +++ b/src/Providers/ClientServiceProvider.php @@ -31,8 +31,4 @@ class ClientServiceProvider extends ServiceProvider } } -// public function provides() -// { -// return ['rpc']; -// } } \ No newline at end of file