From a5d8b283f42648b3a4c0937c3186432a368448e1 Mon Sep 17 00:00:00 2001 From: Shai Katz Date: Mon, 29 Mar 2021 16:45:52 +0300 Subject: [PATCH] First subscribe again, then dispose --- src/crd-controller/HostedServices/V1Alpha2Controller.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/crd-controller/HostedServices/V1Alpha2Controller.cs b/src/crd-controller/HostedServices/V1Alpha2Controller.cs index 030c6a4d..e71e0d22 100644 --- a/src/crd-controller/HostedServices/V1Alpha2Controller.cs +++ b/src/crd-controller/HostedServices/V1Alpha2Controller.cs @@ -76,8 +76,9 @@ public Task StartAsync(CancellationToken token) mSubscription = ObserveKamusSecret(token); Observable.Interval(TimeSpan.FromSeconds(mReconciliationIntervalInSeconds)).Subscribe((s) => { - mSubscription.Dispose(); + var oldSubscription = mSubscription; mSubscription = ObserveKamusSecret(token); + oldSubscription.Dispose(); }); mLogger.Information("Starting watch for KamusSecret V1Alpha2 events");