dispose cts after call finish (#1128)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
namespace k8s;
|
||||
|
||||
public partial class AbstractKubernetes : I{{name}}Operations
|
||||
{
|
||||
{
|
||||
{{#apis}}
|
||||
/// <inheritdoc/>
|
||||
async Task<HttpOperationResponse{{GetReturnType operation "<>"}}> I{{name}}Operations.{{GetMethodName operation "WithHttpMessagesAsync"}}(
|
||||
@@ -17,7 +17,7 @@ public partial class AbstractKubernetes : I{{name}}Operations
|
||||
IReadOnlyDictionary<string, IReadOnlyList<string>> customHeaders,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
||||
using var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
||||
cts.CancelAfter(HttpClientTimeout);
|
||||
{{#IfParamContains operation "watch"}}
|
||||
if (watch == true)
|
||||
@@ -58,13 +58,13 @@ public partial class AbstractKubernetes : I{{name}}Operations
|
||||
{{#IfParamDoesNotContain operation "body"}}
|
||||
var httpResponse = await SendRequest<object>(url, HttpMethods.{{Method}}, customHeaders, null, cancellationToken);
|
||||
{{/IfParamDoesNotContain operation "body"}}
|
||||
// Create Result
|
||||
// Create Result
|
||||
var httpRequest = httpResponse.RequestMessage;
|
||||
{{#IfReturnType operation "void"}}
|
||||
HttpOperationResponse result = new HttpOperationResponse() { Request = httpRequest, Response = httpResponse };
|
||||
{{/IfReturnType operation "void"}}
|
||||
{{#IfReturnType operation "obj"}}
|
||||
var result = await CreateResultAsync{{GetReturnType operation "<>"}}(
|
||||
var result = await CreateResultAsync{{GetReturnType operation "<>"}}(
|
||||
httpRequest,
|
||||
httpResponse,
|
||||
{{#IfParamContains operation "watch"}}
|
||||
|
||||
Reference in New Issue
Block a user