Skip to content

Commit

Permalink
Merge pull request #949 from DFE-Digital/hotfix/change-for-merge
Browse files Browse the repository at this point in the history
Hotfix/change for merge
  • Loading branch information
DrewAire authored Jan 17, 2025
2 parents 06aa523 + 7f47c7a commit 7d45007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Web application to help schools plan a technology roadmap

## Requirements

- .Net 8.0 and any supported IDE for DEV running.
- .Net 8.0 and any supported IDE for DEV running.

## Running Locally

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ public Task RegisterDependenciesAsync<T>(IDatabase database, string key, T value
private async Task GetAndSetDependencies<T>(IDatabase database, string key, T value)
{
var batch = database.CreateBatch();
var tasks = GetDependencies(value).Select(dependency => batch.SetAddAsync(GetDependencyKey(dependency), key, CommandFlags.FireAndForget)).ToArray();
var tasks = GetDependencies(value).Distinct()
.Select(dependency => batch.SetAddAsync(GetDependencyKey(dependency), key, CommandFlags.FireAndForget))
.ToArray();

if (tasks.Length == 0)
{
// If the value has no dependencies (is empty) it should be invalidated when new content comes in
tasks = tasks.Append(batch.SetAddAsync(EmptyCollectionDependencyKey, key, CommandFlags.FireAndForget)).ToArray();
}

batch.Execute();
await Task.WhenAll(tasks);
}
Expand Down

0 comments on commit 7d45007

Please sign in to comment.