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

ClientClusterManifestProvider: fix case where gateway returns no update #8782

Merged
merged 2 commits into from
Dec 16, 2023
Merged
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
12 changes: 10 additions & 2 deletions src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@ private async Task RunAsync()
return;
}

var updateResult = await refreshTask;
var updateResult = await refreshTask;
if (updateResult is null)
{
// There was no newer cluster manifest, so wait for the next refresh interval and try again.
await Task.WhenAny(cancellationTask, Task.Delay(_typeManagementOptions.TypeMapRefreshInterval));
continue;
}

gatewayVersion = updateResult.Version;

// If the manifest does not contain all active servers, merge with the existing manifest until it does.
Expand Down Expand Up @@ -176,11 +183,12 @@ private async Task RunAsync()
}
}

private async Task<ClusterManifestUpdate> GetClusterManifestUpdate(IClusterManifestSystemTarget provider, MajorMinorVersion previousVersion)
private async Task<ClusterManifestUpdate?> GetClusterManifestUpdate(IClusterManifestSystemTarget provider, MajorMinorVersion previousVersion)
{
try
{
// First, attempt to call the new API, which provides more information.
// This returns null if there is no newer cluster manifest.
return await provider.GetClusterManifestUpdate(previousVersion);
}
catch (Exception exception)
Expand Down
4 changes: 2 additions & 2 deletions src/Orleans.Core/Manifest/IClusterManifestSystemTarget.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
#nullable enable
using System.Collections.Immutable;
using System.Threading.Tasks;
using Orleans.Metadata;
Expand All @@ -20,7 +20,7 @@ internal interface IClusterManifestSystemTarget : ISystemTarget
/// Gets an updated cluster manifest if newer than the provided <paramref name="previousVersion"/>.
/// </summary>
/// <returns>The current cluster manifest, or <see langword="null"/> if it is not newer than the provided version.</returns>
ValueTask<ClusterManifestUpdate> GetClusterManifestUpdate(MajorMinorVersion previousVersion);
ValueTask<ClusterManifestUpdate?> GetClusterManifestUpdate(MajorMinorVersion previousVersion);
}

/// <summary>
Expand Down
Loading