public async Task InsertRecordAsync()

in src/Apache.IoTDB/SessionPool.cs [651:694]


        public async Task<int> InsertRecordAsync(string deviceId, RowRecord record)
        {
            // TBD by Luzhan
            var client = _clients.Take();
            var req = new TSInsertRecordReq(client.SessionId, deviceId, record.Measurements, record.ToBytes(),
                record.Timestamps);
            try
            {
                var status = await client.ServiceClient.insertRecordAsync(req);
                if (_debugMode)
                {
                    _logger.LogInformation("insert one record to device {0}, server message: {1}", deviceId, 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.insertRecordAsync(req);

                    if (_debugMode)
                    {
                        _logger.LogInformation("insert one record to device {0}, server message: {1}", deviceId, status.Message);
                    }

                    return _utilFunctions.VerifySuccess(status, SuccessCode, RedirectRecommendCode);

                }
                catch (TException ex)
                {
                    throw new TException("Error occurs when inserting record", ex);
                }
            }
            finally
            {
                _clients.Add(client);
            }
        }