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

Implement Broker Redirects for Session and Messages #3103

Merged
merged 19 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix more tests
  • Loading branch information
luketomlinson committed Jan 30, 2024
commit 238a54dafdc2136e574c2c5a493b12fd6134ceb5
13 changes: 12 additions & 1 deletion src/Runner.Listener/BrokerMessageListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public async Task<Boolean> CreateSessionAsync(CancellationToken token)
var serverUrl = _settings.ServerUrlV2;
Trace.Info(_settings);

if (string.IsNullOrEmpty(_settings.ServerUrlV2))
{
throw new InvalidOperationException("ServerUrlV2 is not set");
}

// Create connection.
Trace.Info("Loading Credentials");
var credMgr = HostContext.GetService<ICredentialManager>();
Expand Down Expand Up @@ -380,6 +385,12 @@ ex is AccessDeniedException ||
Trace.Info($"Non-retriable exception: {ex.Message}");
return false;
}

else if (ex is InvalidOperationException)
{
Trace.Info($"Non-retriable exception: {ex.Message}");
return false;
}
else
{
Trace.Info($"Retriable exception: {ex.Message}");
Expand All @@ -392,7 +403,7 @@ private async Task RefreshBrokerConnection()
var configManager = HostContext.GetService<IConfigurationManager>();
_settings = configManager.LoadSettings();

if (_settings.ServerUrlV2 == null)
if (string.IsNullOrEmpty(_settings.ServerUrlV2))
{
throw new InvalidOperationException("ServerUrlV2 is not set");
}
Expand Down
2 changes: 1 addition & 1 deletion src/Test/L0/Listener/BrokerMessageListenerL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public sealed class BrokerMessageListenerL0

public BrokerMessageListenerL0()
{
_settings = new RunnerSettings { AgentId = 1, AgentName = "myagent", PoolId = 123, PoolName = "default", ServerUrl = "http://myserver", WorkFolder = "_work" };
_settings = new RunnerSettings { AgentId = 1, AgentName = "myagent", PoolId = 123, PoolName = "default", ServerUrl = "http://myserver", WorkFolder = "_work", ServerUrlV2 = "http://myserverv2" };
_config = new Mock<IConfigurationManager>();
_config.Setup(x => x.LoadSettings()).Returns(_settings);
_credMgr = new Mock<ICredentialManager>();
Expand Down
Loading