-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AsyncLazy will cache the exceptions #19
Comments
That doesn’t matter in this case but it does matter for the caching case so I’ll update that. Thanks for the feedback |
Same comment as gravity00, when an exception occurs at the fetch if the value to be cached, exception is cached instead. it might be also needed to handle the case when valueFactory returns (Null OR Default) value that we don't want to cache, in that case cache entry should be disposed rather than being saved as Task that returns null. |
I have a TaskCell that implements this wrapping over LazyTask: https://github.com/jet/equinox/blob/master/src/Equinox.Core/TaskCell.fs (it also manages expiration of the cached value - see the tests: https://github.com/jet/equinox/blob/master/tests/Equinox.Core.Tests/TaskCellTests.fs https://github.com/jet/equinox/blob/master/tests/Equinox.Core.Tests/LazyTaskTests.fs) |
AspNetCoreDiagnosticScenarios/Scenarios/Services/RemoteConnection.cs
Lines 55 to 90 in 5be73c4
I believe it should be at least noted that if an exception occurs inside the factory function, the exception will be cached by the
Task
and since everything is a singleton, the application won't be able to recover from the failed state without some restart (unless I'm missing something).Obviously this may or may not be a problem, depends on the developer needs, but usually this isn't the intended behavior. Most commonly is like not adding an item to a cache if the initialization fails.
The text was updated successfully, but these errors were encountered: