THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

log: add log for config rpc server request handler

pull/112/head
catcherwong 2 months ago
parent
commit
7000290bd7
  1. 7
      src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs
  2. 2
      src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs

7
src/Nacos/V2/Config/Impl/ConfigRpcServerRequestHandler.cs

@ -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;
@ -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;
}
@ -41,7 +44,7 @@
_func.Invoke().Wait();
}
Console.WriteLine("Config RequestReply => {0}", request.ToJsonString());
_logger?.LogDebug("Config RequestReply => {0}", request.ToJsonString());
return new ConfigChangeNotifyResponse();
}

2
src/Nacos/V2/Config/Impl/ConfigRpcTransportClient.cs

@ -247,7 +247,7 @@
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));

Loading…
Cancel
Save