From 5388c25bbe79bffc49c047d8e2fa50217f2145f4 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 23 Apr 2018 11:05:43 -0400 Subject: [PATCH 1/2] Fix to cache updating After we get the invalidation event form the cache, the cache will not send another invalidation event until it gets a new data set. User should retrieve the data after it has been initialized if the cache has previously signaled the data is invalid. --- src/GitHub.Api/Git/Repository.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/GitHub.Api/Git/Repository.cs b/src/GitHub.Api/Git/Repository.cs index b5e4d7da7..34ac47be5 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -409,7 +409,10 @@ public void Initialize(IGitClient client) Guard.ArgumentNotNull(client, nameof(client)); gitClient = client; if (needsRefresh) - cacheContainer.GitUserCache.InvalidateData(); + { + needsRefresh = false; + UpdateUserAndEmail(); + } } public void SetNameAndEmail(string name, string email) From 532bfe04d888101db17ec7d7b0aeb30d11496a57 Mon Sep 17 00:00:00 2001 From: Andreia Gaita Date: Tue, 24 Apr 2018 14:59:36 -0400 Subject: [PATCH 2/2] We should call the same method that the event handler does --- src/GitHub.Api/Git/Repository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GitHub.Api/Git/Repository.cs b/src/GitHub.Api/Git/Repository.cs index 34ac47be5..e4828db4c 100644 --- a/src/GitHub.Api/Git/Repository.cs +++ b/src/GitHub.Api/Git/Repository.cs @@ -411,7 +411,7 @@ public void Initialize(IGitClient client) if (needsRefresh) { needsRefresh = false; - UpdateUserAndEmail(); + GitUserCacheOnCacheInvalidated(); } }