You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since everything in the package is static and the the LazyData initialisation uses the default Lazy function, when there is an IO issue and the file is not successfully loaded the first time, the exception is also cached and the package will no longer work until the process is restarted.
This allows multiple threads to start the initialization but the first successful thread value will be cached for subsequent Value access.
And exceptions are never cached so that would fix the issue entirely as far I can see.
The text was updated successfully, but these errors were encountered:
GeoTimeZone/src/GeoTimeZone/TimezoneFileReader.cs
Line 10 in deb5e6c
Since everything in the package is static and the the LazyData initialisation uses the default Lazy function, when there is an IO issue and the file is not successfully loaded the first time, the exception is also cached and the package will no longer work until the process is restarted.
So this could be done instead:
private static readonly Lazy<MemoryStream> LazyData = new(LoadData, LazyThreadSafetyMode.PublicationOnly);
This allows multiple threads to start the initialization but the first successful thread value will be cached for subsequent Value access.
And exceptions are never cached so that would fix the issue entirely as far I can see.
The text was updated successfully, but these errors were encountered: