Skip to content
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

Set timeout when sending live console log to service #1903

Merged
merged 1 commit into from
May 21, 2022

Conversation

TingluoHuang
Copy link
Member

The websocketClient.SendAsync() doesn't have a default timeout, which means if the WebSocket is in a bad state, the client (runner) won't abort the request until the service kills the connection after 10 minutes (Max connection time control by AFD).

I am adding a CancellationToken to auto-fire after 60 seconds to avoid the runner sitting there and waiting for the 10 minutes timeout.

@TingluoHuang TingluoHuang requested a review from a team as a code owner May 19, 2022 03:56
@@ -1,5 +1,4 @@
using GitHub.DistributedTask.WebApi;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hide whitespace when reviewing.

@@ -274,7 +274,7 @@ public async Task AppendTimelineRecordFeedAsync(Guid scopeIdentifier, string hub
}
}

if (!pushedLinesViaWebsocket)
if (!pushedLinesViaWebsocket && !cancellationToken.IsCancellationRequested)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

failback to HttpClient only if we haven't been cancelled.

@@ -48,7 +48,7 @@

<Target Name="Test" DependsOnTargets="GenerateConstant">
<Exec Command="dotnet build Test/Test.csproj -c $(BUILDCONFIG) /p:PackageRuntime=$(PackageRuntime)" ConsoleToMSBuild="true" />
<Exec Command="dotnet test Test/Test.csproj --no-build --logger:trx" ConsoleToMSBuild="true" />
<Exec Command="dotnet test Test/Test.csproj -c $(BUILDCONFIG) --no-build --logger:trx" ConsoleToMSBuild="true" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i noticed ./dev.sh test Release is not working... this should fix it.

Copy link
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@TingluoHuang TingluoHuang merged commit 0b73794 into main May 21, 2022
@TingluoHuang TingluoHuang deleted the users/tihuang/fixwebsockettimeout branch May 21, 2022 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants