public async Task IsPathExistInTemplate()

in src/Apache.IoTDB/SessionPool.cs [2250:2293]


        public async Task<bool> IsPathExistInTemplate(string templateName, string path)
        {
            var client = _clients.Take();
            var req = new TSQueryTemplateReq(client.SessionId, templateName, (int)TemplateQueryType.PATH_EXIST);
            req.Measurement = path;
            try
            {
                var resp = await client.ServiceClient.querySchemaTemplateAsync(req);
                var status = resp.Status;
                if (_debugMode)
                {
                    _logger.LogInformation("is path exist in template {0} message: {1}", templateName, status.Message);
                }

                _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
                return resp.Result;
            }
            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("is path exist in template {0} message: {1}", templateName, status.Message);
                    }

                    _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);
                    return resp.Result;
                }
                catch (TException ex)
                {
                    throw new TException("Error occurs when checking path exist in template", ex);
                }
            }
            finally
            {
                _clients.Add(client);
            }
        }