Tags: buehler/dotnet-operator-sdk
Tags
fix: Leader election failure to restart (#783) This fixes the following behavioral issues noted when testing a leader-aware operator with transient network issues: - In `LeaderElectionBackgroundService`, if `elector.RunUntilLeadershipLostAsync()` throws, the exception is not observed in the library and no further attempts to become the leader occur. The library now logs any unexpected exceptions and tries to become the leader again. - A leader could not stop and then subsequently start being a leader once more due to cancellation token sources not being recreated. The library now disposes and recreates the cancellation token sources as required. - `LeaderAwareResourceWatcher<TEntity>.StoppedLeading` would erroneously pass a cancelled cancellation token to `ResourceWatcher<TEntity>`. The library now passes the `IHostApplicationLifetime.ApplicationStopped` token to the `ResourceWatcher<TEntity>` - we can assume that `ApplicationStopped` is a good indication that the stop should no longer be graceful.
fix(watcher): reconnect after server or client timeout (#780) This fixes #739. This closes #771. Allows the resource watcher to retry the connection until the cancellation token requests a stop. The watcher caches the received entities and checks for their keys in a concurrent dictionary. Recurring "added" events after reconnection should not trigger a reconciliation.
fix(client): don't access disposed resources (#738) This PR is ensuring that the host does not stop with an exception. Those exceptions were occuring because the `CancellationTokenSource` inside the hosted services was already disposed when `StopAsync` got called. The reason for this is that the host invokes `DisposeAsync` **before** `StopAsync`.
PreviousNext