Skip to content

Add http2 keep alive in watch #779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 55 additions & 55 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '15 23 * * 1'

jobs:
analyze:
name: Analyze
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup dotnet SDK 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Setup dotnet SDK 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Setup dotnet SDK 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '15 23 * * 1'
jobs:
analyze:
name: Analyze
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup dotnet SDK 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Setup dotnet SDK 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Setup dotnet SDK 6
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
9 changes: 7 additions & 2 deletions src/KubernetesClient/Kubernetes.ConfigInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private void CreateHttpClient(DelegatingHandler[] handlers, KubernetesClientConf
FirstMessageHandler = HttpClientHandler = CreateRootHandler();


#if NET5_0
#if NET5_0_OR_GREATER
// https://github.com/kubernetes-client/csharp/issues/587
// let user control if tcp keep alive until better fix
if (config.TcpKeepAlive)
Expand All @@ -192,7 +192,12 @@ private void CreateHttpClient(DelegatingHandler[] handlers, KubernetesClientConf
//
// Should remove after better solution

var sh = new SocketsHttpHandler();
var sh = new SocketsHttpHandler
{
KeepAlivePingPolicy = HttpKeepAlivePingPolicy.WithActiveRequests,
KeepAlivePingDelay = TimeSpan.FromMinutes(3),
KeepAlivePingTimeout = TimeSpan.FromSeconds(30),
};
sh.ConnectCallback = async (context, token) =>
{
var socket = new Socket(SocketType.Stream, ProtocolType.Tcp)
Expand Down
2 changes: 1 addition & 1 deletion src/KubernetesClient/Kubernetes.WebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ protected async Task<WebSocket> StreamConnectAsync(Uri uri, string webSocketSubP
}
else
{
#if NET5_0
#if NET5_0_OR_GREATER
var content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
#else
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Expand Down