Skip to content

Commit

Permalink
Enable nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
ReubenBond committed Dec 15, 2023
1 parent 05084e4 commit 3f44c5a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Orleans.Core/Manifest/ClientClusterManifestProvider.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
Expand Down Expand Up @@ -30,7 +30,7 @@ internal class ClientClusterManifestProvider : IClusterManifestProvider, IAsyncD
private readonly AsyncEnumerable<ClusterManifest> _updates;
private readonly CancellationTokenSource _cancellation = new CancellationTokenSource();
private ClusterManifest _current;
private Task _runTask;
private Task? _runTask;

public ClientClusterManifestProvider(
IServiceProvider services,
Expand All @@ -45,7 +45,7 @@ public ClientClusterManifestProvider(
_services = services;
_localClientDetails = localClientDetails;
_gatewayManager = gatewayManager;
this.LocalGrainManifest = clientManifestProvider.ClientManifest;
LocalGrainManifest = clientManifestProvider.ClientManifest;

// Create a fake manifest for the very first generation, which only includes the local client's manifest.
var builder = ImmutableDictionary.CreateBuilder<SiloAddress, GrainManifest>();
Expand Down Expand Up @@ -83,11 +83,10 @@ private async Task RunAsync()
{
var grainFactory = _services.GetRequiredService<IInternalGrainFactory>();
var cancellationTask = _cancellation.Token.WhenCancelled();
SiloAddress gateway = null;
IClusterManifestSystemTarget provider = null;
SiloAddress? gateway = null;
IClusterManifestSystemTarget? provider = null;
var minorVersion = 0;
var gatewayVersion = MajorMinorVersion.MinValue;
var updateIncludesAllActiveServers = false;
while (!_cancellation.IsCancellationRequested)
{
// Select a new gateway if the current one is not available.
Expand Down Expand Up @@ -124,13 +123,13 @@ private async Task RunAsync()
await Task.WhenAny(cancellationTask, Task.Delay(_typeManagementOptions.TypeMapRefreshInterval));
continue;
}
updateIncludesAllActiveServers = updateResult.IncludesAllActiveServers;

gatewayVersion = updateResult.Version;

// If the manifest does not contain all active servers, merge with the existing manifest until it does.
// This prevents reversed progress at the expense of including potentially defunct silos.
ImmutableDictionary<SiloAddress, GrainManifest> siloManifests;
if (!updateIncludesAllActiveServers)
if (!updateResult.IncludesAllActiveServers)
{
// Merge manifests until the manifest contains all active servers.
var mergedSilos = _current.Silos.ToBuilder();
Expand Down

0 comments on commit 3f44c5a

Please sign in to comment.