Skip to content

Commit 53073ee

Browse files
committed
Fix potential race condition in CompiledViewsCache by completing TCS before removal
1 parent d7bc06c commit 53073ee

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/Infrastructure/LeanCode.ViewRenderer.Razor/CompiledViewsCache.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public ValueTask<CompiledView> GetOrCompileAsync(string viewName)
5050
"View type for {ViewName} was added to cache while we were setting up compilation",
5151
viewName
5252
);
53+
// Complete the TCS before removing - other threads may be waiting on it
54+
tcs.SetResult(compiled);
5355
buildCache.TryRemove(viewName, out _);
5456
return new ValueTask<CompiledView>(compiled);
5557
}

0 commit comments

Comments
 (0)