in src/Apache.IoTDB/SessionPool.cs [2162:2204]
public async Task<int> CountMeasurementsInTemplateAsync(string name)
{
var client = _clients.Take();
var req = new TSQueryTemplateReq(client.SessionId, name, (int)TemplateQueryType.COUNT_MEASUREMENTS);
try
{
var resp = await client.ServiceClient.querySchemaTemplateAsync(req);
var status = resp.Status;
if (_debugMode)
{
_logger.LogInformation("count measurements in template {0} message: {1}", name, status.Message);
}
_utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
return resp.Count;
}
catch (TException e)
{
await Open(_enableRpcCompression);
client = _clients.Take();
req.SessionId = client.SessionId;
try
{
var resp = await client.ServiceClient.querySchemaTemplateAsync(req);
var status = resp.Status;
if (_debugMode)
{
_logger.LogInformation("count measurements in template {0} message: {1}", name, status.Message);
}
_utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
return resp.Count;
}
catch (TException ex)
{
throw new TException("Error occurs when counting measurements in template", ex);
}
}
finally
{
_clients.Add(client);
}
}