Skip to content

Commit

Permalink
Improved the performance of TableServiceClient.GetTableClient() (#47406)
Browse files Browse the repository at this point in the history
  • Loading branch information
christothes authored Dec 5, 2024
1 parent f2cc51a commit 43fa107
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions sdk/tables/Azure.Data.Tables/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Bugs Fixed

### Other Changes
- Improved the performance of `TableServiceClient.GetTableClient()`

## 12.9.1 (2024-09-17)

Expand Down
10 changes: 6 additions & 4 deletions sdk/tables/Azure.Data.Tables/src/TableClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public TableClient(string connectionString, string tableName, TableClientOptions
_version = options.VersionString;
_diagnostics = new ClientDiagnostics(options);
_tableOperations = new TableRestClient(_diagnostics, _pipeline, _endpoint.AbsoluteUri, _version);
_batchOperations = new TableRestClient(_diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
_batchOperations = new TableRestClient(_diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
Name = tableName;
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
}
Expand Down Expand Up @@ -286,7 +286,7 @@ public TableClient(Uri endpoint, string tableName, TokenCredential tokenCredenti
_version = options.VersionString;
_diagnostics = new ClientDiagnostics(options);
_tableOperations = new TableRestClient(_diagnostics, _pipeline, _endpoint.AbsoluteUri, _version);
_batchOperations = new TableRestClient(_diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
_batchOperations = new TableRestClient(_diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
Name = tableName;
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
}
Expand Down Expand Up @@ -337,7 +337,7 @@ null when string.IsNullOrWhiteSpace(_endpoint.Query) => policy,
_version = options.VersionString;
_diagnostics = new ClientDiagnostics(options);
_tableOperations = new TableRestClient(_diagnostics, _pipeline, _endpoint.AbsoluteUri, _version);
_batchOperations = new TableRestClient(_diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
_batchOperations = new TableRestClient(_diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
Name = tableName;
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
}
Expand All @@ -363,7 +363,7 @@ internal TableClient(
{
_tableOperations = tableOperations;
}
_batchOperations = new TableRestClient(diagnostics, CreateBatchPipeline(), _tableOperations.endpoint, _tableOperations.clientVersion);
_batchOperations = new TableRestClient(diagnostics, _batchPipeline, _tableOperations.endpoint, _tableOperations.clientVersion);
_version = version;
Name = table;
Uri = new TableUriBuilder(_endpoint) { Query = null, Sas = null, Tablename = Name }.ToUri();
Expand Down Expand Up @@ -1743,6 +1743,8 @@ private HttpMessage CreateUpdateOrMergeRequest(TableRestClient batchOperations,
return msg;
}

private static readonly HttpPipeline _batchPipeline = CreateBatchPipeline();

/// <summary>
/// Creates a pipeline to use for processing sub-operations before they are combined into a single multipart request.
/// </summary>
Expand Down

0 comments on commit 43fa107

Please sign in to comment.