Skip to content

Commit

Permalink
Merge pull request #112 from nacos-group/dev
Browse files Browse the repository at this point in the history
log: add log for config rpc server request handler
  • Loading branch information
catcherwong authored Jun 13, 2021
2 parents 9577a69 + 7000290 commit f21c576
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace Nacos.V2.Config.Impl
{
using Microsoft.Extensions.Logging;
using Nacos.V2.Remote;
using Nacos.V2.Remote.Requests;
using Nacos.V2.Remote.Responses;
Expand All @@ -10,11 +11,13 @@

public class ConfigRpcServerRequestHandler : IServerRequestHandler
{
private readonly ILogger _logger;
private ConcurrentDictionary<string, CacheData> _cacheMap;
private Func<Task> _func;

public ConfigRpcServerRequestHandler(ConcurrentDictionary<string, CacheData> map, Func<Task> func)
public ConfigRpcServerRequestHandler(ILogger logger, ConcurrentDictionary<string, CacheData> map, Func<Task> func)
{
this._logger = logger;
this._cacheMap = map;
this._func = func;
}
Expand All @@ -41,7 +44,7 @@ public CommonResponse RequestReply(CommonRequest request)
_func.Invoke().Wait();
}

Console.WriteLine("Config RequestReply => {0}", request.ToJsonString());
_logger?.LogDebug("Config RequestReply => {0}", request.ToJsonString());

return new ConfigChangeNotifyResponse();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ private ClientAbilities InitAbilities()

private void InitHandlerRpcClient(RpcClient rpcClientInner)
{
rpcClientInner.RegisterServerPushResponseHandler(new ConfigRpcServerRequestHandler(_cacheMap, NotifyListenConfig));
rpcClientInner.RegisterServerPushResponseHandler(new ConfigRpcServerRequestHandler(_logger, _cacheMap, NotifyListenConfig));
rpcClientInner.RegisterConnectionListener(new ConfigRpcConnectionEventListener(_logger, rpcClientInner, _cacheMap, _listenExecutebell));

rpcClientInner.Init(new ConfigRpcServerListFactory(_serverListManager));
Expand Down

0 comments on commit f21c576

Please sign in to comment.