Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 44971cc

Browse files
committed
Merge pull request #168 from github/fixes/repository-list
Fix repository list not refreshing
2 parents 78f68ca + 702665b commit 44971cc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/GitHub.App/Services/ModelService.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ IObservable<IEnumerable<AccountCacheItem>> GetUser()
9898
{
9999
return hostCache.GetAndRefreshObject("user",
100100
() => apiClient.GetUser().Select(AccountCacheItem.Create), TimeSpan.FromMinutes(5), TimeSpan.FromDays(7))
101-
.Take(1)
101+
.TakeLast(1)
102102
.ToList();
103103
}
104104

@@ -107,7 +107,7 @@ IObservable<IEnumerable<AccountCacheItem>> GetUserOrganizations()
107107
return GetUserFromCache().SelectMany(user =>
108108
hostCache.GetAndRefreshObject(user.Login + "|orgs",
109109
() => apiClient.GetOrganizations().Select(AccountCacheItem.Create).ToList(),
110-
TimeSpan.FromMinutes(5), TimeSpan.FromDays(7)))
110+
TimeSpan.FromMinutes(2), TimeSpan.FromDays(7)))
111111
.Catch<IEnumerable<AccountCacheItem>, KeyNotFoundException>(
112112
// This could in theory happen if we try to call this before the user is logged in.
113113
e =>
@@ -125,8 +125,8 @@ IObservable<IEnumerable<AccountCacheItem>> GetUserOrganizations()
125125
public IObservable<IReadOnlyList<IRepositoryModel>> GetRepositories()
126126
{
127127
return GetUserRepositories(RepositoryType.Owner)
128-
.Take(1)
129-
.Concat(GetUserRepositories(RepositoryType.Member).Take(1))
128+
.TakeLast(1)
129+
.Concat(GetUserRepositories(RepositoryType.Member).TakeLast(1))
130130
.Concat(GetAllRepositoriesForAllOrganizations());
131131
}
132132

@@ -174,7 +174,7 @@ IObservable<IReadOnlyList<IRepositoryModel>> GetUserRepositories(RepositoryType
174174
return Observable.Defer(() => GetUserFromCache().SelectMany(user =>
175175
hostCache.GetAndRefreshObject(string.Format(CultureInfo.InvariantCulture, "{0}|{1}:repos", user.Login, repositoryType),
176176
() => GetUserRepositoriesFromApi(repositoryType),
177-
TimeSpan.FromMinutes(5),
177+
TimeSpan.FromMinutes(2),
178178
TimeSpan.FromDays(7)))
179179
.ToReadOnlyList(Create))
180180
.Catch<IReadOnlyList<IRepositoryModel>, KeyNotFoundException>(
@@ -202,7 +202,7 @@ IObservable<IReadOnlyList<IRepositoryModel>> GetAllRepositoriesForAllOrganizatio
202202
{
203203
return GetUserOrganizations()
204204
.SelectMany(org => org.ToObservable())
205-
.SelectMany(org => GetOrganizationRepositories(org.Login).Take(1));
205+
.SelectMany(org => GetOrganizationRepositories(org.Login).TakeLast(1));
206206
}
207207

208208
IObservable<IReadOnlyList<IRepositoryModel>> GetOrganizationRepositories(string organization)
@@ -211,7 +211,7 @@ IObservable<IReadOnlyList<IRepositoryModel>> GetOrganizationRepositories(string
211211
hostCache.GetAndRefreshObject(string.Format(CultureInfo.InvariantCulture, "{0}|{1}|repos", user.Login, organization),
212212
() => apiClient.GetRepositoriesForOrganization(organization).Select(
213213
RepositoryCacheItem.Create).ToList(),
214-
TimeSpan.FromMinutes(5),
214+
TimeSpan.FromMinutes(2),
215215
TimeSpan.FromDays(7)))
216216
.ToReadOnlyList(Create))
217217
.Catch<IReadOnlyList<IRepositoryModel>, KeyNotFoundException>(

0 commit comments

Comments
 (0)