Skip to content

Commit

Permalink
#218 - Proper task clearing in middlewares.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Mar 5, 2019
1 parent ebeb1cc commit a803f76
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/Money.UI.Blazor/Services/CategoryMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public async Task<object> ExecuteAsync(object query, HttpQueryDispatcher dispatc
if (models.Count == 0)
{
if (listAllTask == null)
listAllTask = LoadAllAsync(listAll, next);
listAllTask = LoadAllAsync(listAll, next).ContinueWith(t => listAllTask = null);

await listAllTask;
listAllTask = null;
}

return models.Select(c => c.Clone()).ToList();
Expand Down
3 changes: 1 addition & 2 deletions src/Money.UI.Blazor/Services/CurrencyMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ public async Task<object> ExecuteAsync(object query, HttpQueryDispatcher dispatc
if (models.Count == 0)
{
if (listAllTask == null)
listAllTask = LoadAllAsync(listAll, next);
listAllTask = LoadAllAsync(listAll, next).ContinueWith(t => listAllTask = null);

await listAllTask;
listAllTask = null;
}

return models.Select(c => c.Clone()).ToList();
Expand Down
3 changes: 1 addition & 2 deletions src/Money.UI.Blazor/Services/UserMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ public async Task<object> ExecuteAsync(object query, HttpQueryDispatcher dispatc
if (profile == null)
{
if (getProfileTask == null)
getProfileTask = LoadProfileAsync(getProfile, next);
getProfileTask = LoadProfileAsync(getProfile, next).ContinueWith(t => getProfileTask = null);

await getProfileTask;
getProfileTask = null;
}

return profile;
Expand Down

0 comments on commit a803f76

Please sign in to comment.