优化代码
This commit is contained in:
parent
e35172d69f
commit
80b8942d9d
@ -64,7 +64,7 @@ namespace JiShe.CollectBus.DataChannels
|
|||||||
ChannelReader<ValueTuple<string, List<MeterReadingTelemetryPacketInfo>>> telemetryPacketInfoReader)
|
ChannelReader<ValueTuple<string, List<MeterReadingTelemetryPacketInfo>>> telemetryPacketInfoReader)
|
||||||
{
|
{
|
||||||
const int BatchSize = 100000;
|
const int BatchSize = 100000;
|
||||||
const int EmptyWaitMilliseconds = 200;
|
const int EmptyWaitMilliseconds = 50;
|
||||||
var timeout = TimeSpan.FromSeconds(5);
|
var timeout = TimeSpan.FromSeconds(5);
|
||||||
var timer = Stopwatch.StartNew();
|
var timer = Stopwatch.StartNew();
|
||||||
long timeoutMilliseconds = 0;
|
long timeoutMilliseconds = 0;
|
||||||
@ -83,7 +83,7 @@ namespace JiShe.CollectBus.DataChannels
|
|||||||
_logger.LogError($"{nameof(ScheduledMeterTaskReadingAsync)} 通道处理数据耗时{timeoutMilliseconds}毫秒");
|
_logger.LogError($"{nameof(ScheduledMeterTaskReadingAsync)} 通道处理数据耗时{timeoutMilliseconds}毫秒");
|
||||||
}
|
}
|
||||||
timeoutMilliseconds = 0;
|
timeoutMilliseconds = 0;
|
||||||
//无消息时短等待1秒
|
//无消息时短等待50毫秒
|
||||||
await Task.Delay(EmptyWaitMilliseconds);
|
await Task.Delay(EmptyWaitMilliseconds);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user