Always Delete Actions Service Session (#3214)

* Delete Actions Service session always

* update tes
This commit is contained in:
Luke Tomlinson
2024-03-21 16:30:34 -04:00
committed by GitHub
parent 4b85145661
commit 8ebf298bcd
2 changed files with 3 additions and 3 deletions

View File

@@ -188,12 +188,12 @@ namespace GitHub.Runner.Listener
{ {
using (var ts = new CancellationTokenSource(TimeSpan.FromSeconds(30))) using (var ts = new CancellationTokenSource(TimeSpan.FromSeconds(30)))
{ {
await _runnerServer.DeleteAgentSessionAsync(_settings.PoolId, _session.SessionId, ts.Token);
if (_isBrokerSession) if (_isBrokerSession)
{ {
await _brokerServer.DeleteSessionAsync(ts.Token); await _brokerServer.DeleteSessionAsync(ts.Token);
return;
} }
await _runnerServer.DeleteAgentSessionAsync(_settings.PoolId, _session.SessionId, ts.Token);
} }
} }
else else

View File

@@ -272,7 +272,7 @@ namespace GitHub.Runner.Common.Tests.Listener
//Assert //Assert
_runnerServer _runnerServer
.Verify(x => x.DeleteAgentSessionAsync( .Verify(x => x.DeleteAgentSessionAsync(
_settings.PoolId, expectedSession.SessionId, It.IsAny<CancellationToken>()), Times.Never()); _settings.PoolId, expectedBrokerSession.SessionId, It.IsAny<CancellationToken>()), Times.Once());
_brokerServer _brokerServer
.Verify(x => x.DeleteSessionAsync(It.IsAny<CancellationToken>()), Times.Once()); .Verify(x => x.DeleteSessionAsync(It.IsAny<CancellationToken>()), Times.Once());
} }