in src/Apache.IoTDB/SessionPool.cs [1395:1446]
public async Task<int> InsertRecordsOfOneDeviceSortedAsync(string deviceId, List<RowRecord> rowRecords)
{
var client = _clients.Take();
var timestampLst = rowRecords.Select(x => x.Timestamps).ToList();
if (!_utilFunctions.IsSorted(timestampLst))
{
throw new TException("insert records of one device error: timestamp not sorted", null);
}
var req = GenInsertRecordsOfOneDeviceRequest(deviceId, rowRecords, client.SessionId);
try
{
var status = await client.ServiceClient.insertRecordsOfOneDeviceAsync(req);
if (_debugMode)
{
_logger.LogInformation("insert records of one device, message: {0}", status.Message);
}
return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
}
catch (TException e)
{
await Open(_enableRpcCompression);
client = _clients.Take();
req.SessionId = client.SessionId;
try
{
var status = await client.ServiceClient.insertRecordsOfOneDeviceAsync(req);
if (_debugMode)
{
_logger.LogInformation("insert records of one device, message: {0}", status.Message);
}
return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
}
catch (TException ex)
{
throw new TException("Error occurs when inserting records of one device", ex);
}
}
finally
{
_clients.Add(client);
}
}