当传输超过20s的模型(例如50)时,它将造成数据错误。我已经在客户端和服务器中进行了调试。在客户端中,它向我显示我已经发送了50个数据,但是服务器仅显示我12或24 ...没有50。
rpc Logs (stream LogRequest) returns (WP.GrpcCommon.BoolResponse);
备注:paramList
的计数为50;
public async Task Logs(List<AddParam> paramList)
{
using (var call = Client.Logs())
{
int i = 0;
foreach (var param in paramList)
{
i++;
await call.RequestStream.WriteAsync(new LogRequest()
{
AppUid = param.AppUid,
LogLevel = Contract.Utility.DataExtension.GetLogLevel(param.LogLevel),
Content = param.Content,
TraceId = param.TraceId,
LogTime = param.LogTime.Ticks
});
}
Console.WriteLine($"{DateTime.Now} TransferNum:{paramList.Count} FactNum:{i}");
await call.RequestStream.CompleteAsync();
var response = await call.ResponseAsync;
}
}
public async override Task<BoolResponse> Logs(IAsyncStreamReader<LogRequest> requestStream, ServerCallContext context)
{
while (await requestStream.MoveNext())
{
i++;
Console.WriteLine($"{requestStream.Current.Content}");
}
}
在服务器中,它将显示大约12或24,但没有50;