소스 검색

Code cleanup

master
Savorboard 3 년 전
부모
커밋
740e95ba83
4개의 변경된 파일10개의 추가작업 그리고 9개의 파일을 삭제
  1. +5
    -3
      src/DotNetCore.CAP.NATS/NATSConsumerClient.cs
  2. +2
    -3
      src/DotNetCore.CAP/Internal/Helper.cs
  3. +1
    -1
      src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs
  4. +2
    -2
      src/DotNetCore.CAP/Processor/IProcessor.Collector.cs

+ 5
- 3
src/DotNetCore.CAP.NATS/NATSConsumerClient.cs 파일 보기

@@ -70,13 +70,15 @@ namespace DotNetCore.CAP.NATS
private void Subscription_MessageHandler(object sender, MsgHandlerEventArgs e)
{
var headers = new Dictionary<string, string>();
foreach (string h in e.Message.Header.Keys)
{
headers.Add(h, e.Message.Header[h]);
}
var tranmessage = new TransportMessage(headers, e.Message.Data);
tranmessage.Headers.Add(Headers.Group, _groupId);
OnMessageReceived?.Invoke(e.Message.Reply, tranmessage);

headers.Add(Headers.Group, _groupId);

OnMessageReceived?.Invoke(e.Message.Reply, new TransportMessage(headers, e.Message.Data));
}

public void Commit(object sender)


+ 2
- 3
src/DotNetCore.CAP/Internal/Helper.cs 파일 보기

@@ -66,7 +66,6 @@ namespace DotNetCore.CAP.Internal

public static bool IsInnerIP(string ipAddress)
{
bool isInnerIp;
var ipNum = GetIpNum(ipAddress);

//Private IP:
@@ -80,9 +79,9 @@ namespace DotNetCore.CAP.Internal
var bEnd = GetIpNum("172.31.255.255");
var cBegin = GetIpNum("192.168.0.0");
var cEnd = GetIpNum("192.168.255.255");
isInnerIp = IsInner(ipNum, aBegin, aEnd) || IsInner(ipNum, bBegin, bEnd) || IsInner(ipNum, cBegin, cEnd);
return isInnerIp;
return IsInner(ipNum, aBegin, aEnd) || IsInner(ipNum, bBegin, bEnd) || IsInner(ipNum, cBegin, cEnd);
}

private static long GetIpNum(string ipAddress)
{
var ip = ipAddress.Split('.');


+ 1
- 1
src/DotNetCore.CAP/Internal/ICapPublisher.Default.cs 파일 보기

@@ -30,7 +30,7 @@ namespace DotNetCore.CAP.Internal
ServiceProvider = service;
_dispatcher = service.GetRequiredService<IDispatcher>();
_storage = service.GetRequiredService<IDataStorage>();
_capOptions = service.GetService<IOptions<CapOptions>>().Value;
_capOptions = service.GetRequiredService<IOptions<CapOptions>>().Value;
Transaction = new AsyncLocal<ICapTransaction>();
}



+ 2
- 2
src/DotNetCore.CAP/Processor/IProcessor.Collector.cs 파일 보기

@@ -27,7 +27,7 @@ namespace DotNetCore.CAP.Processor
_serviceProvider = serviceProvider;
_waitingInterval = TimeSpan.FromSeconds(options.Value.CollectorCleaningInterval);

var initializer = _serviceProvider.GetService<IStorageInitializer>();
var initializer = _serviceProvider.GetRequiredService<IStorageInitializer>();

_tableNames = new[] { initializer.GetPublishedTableName(), initializer.GetReceivedTableName() };
}
@@ -42,7 +42,7 @@ namespace DotNetCore.CAP.Processor
var time = DateTime.Now;
do
{
deletedCount = await _serviceProvider.GetService<IDataStorage>()
deletedCount = await _serviceProvider.GetRequiredService<IDataStorage>()
.DeleteExpiresAsync(table, time, ItemBatch, context.CancellationToken);

if (deletedCount != 0)


불러오는 중...
취소
저장