-
-
Notifications
You must be signed in to change notification settings - Fork 346
Fix possible fetch loop in RasterizingLayer depending on timing #3190
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
Conversation
…e to sourceLayer for clearity
…n the page is scrolled
… files seemed to be deployed multple times in parallel, it did cause an error though
…se true, because it is the default, and in this case there was no reason to use true anyway
… local test, lets see if it still works on the server
| { | ||
| Catch.Exceptions(() => | ||
| { | ||
| // The client rect needs updating for scrolling. I would rather do that on the onscroll event but it does not fire on this element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed while trying to fix this issue #3105 but seems to be needed. A bit obscure how this works. It feels like a workaround for how Blazor works.
| { | ||
| _getFetchableSources = getFetchableSources; | ||
| _ = Task.Run(() => AddConsumerAsync(_channel)); | ||
| _ = Task.Run(() => AddConsumerAsync(_channel).ConfigureAwait(false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some ConfigureAwait(false) just to be sure but it did not make a difference for my current problem.
| { | ||
| private readonly ConcurrentStack<RasterFeature> _cache; | ||
| private readonly ILayer _layer; | ||
| private readonly ILayer _sourceLayer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed fields and methods related to the source layer to sourceLayer, which makes the essential part less visible.
| if (_busy) return; | ||
|
|
||
| OnFetchRequested(); | ||
| OnDataChanged(e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the essential part of this MR. Calling the OnFetchRequested causes a loop. By calling OnDataChanged we avoid this, but there is not an unsupported scenario for when a feature in the IProvider is modified. I don't have a solution for this yet.
| var maxPoint = viewport.ScreenToWorld(screenPosition.X + halfSymbolSize, screenPosition.Y + halfSymbolSize); | ||
|
|
||
| var extent = new MRect(minPoint.X, minPoint.Y, maxPoint.X, maxPoint.Y); | ||
| var extent = new MRect(minPoint.X, maxPoint.Y, maxPoint.X, minPoint.Y); // Note that the Y axis is inverted by ScreenToWorld |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cause an error in the logs, although I did not see where it broke functionality, but it probably did.
| _dataFetcher.ViewportChanged(fetchInfo); | ||
| } | ||
|
|
||
| private static FetchInfo? ToFetchInfo(Viewport viewport, ChangeType changeType, string? CRS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not essential, I was trying to understand the code and this change made it a bit easier.
| <PackageReference Include="HarfBuzzSharp.NativeAssets.WebAssembly" /> | ||
| <PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" /> | ||
|
|
||
| <!-- Had to reference sqlite-net-pcl and SQLitePCLRaw.bundle_green because I get an I/O error with the SourceGear ones. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should have been in this previous PR: #3188
| builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); | ||
|
|
||
| Mapsui.Logging.Logger.LogDelegate += (l, m, e) => Console.WriteLine(m + e?.Message); | ||
| Mapsui.Logging.Logger.LogDelegate += (l, m, e) => Console.WriteLine(m + e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging the entire exception plus stack trace because that is was helped me here
| public async Task InitializeTestAsync(IMapControl mapControl) | ||
| { | ||
| await Task.Delay(1000).ConfigureAwait(true); | ||
| await Task.Delay(1000).ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just wrong.
|
|
||
| public static class ShapeFilesDeployer | ||
| { | ||
| private static object _lock = new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This did not cause a bug but it was weird to see that multiple deploys are done in parallel. Sometimes of the same file. We need to check earlier if a deploy has been done already, because the same files are deployed by different samples.
The things changed in this PR came about while working on and testing the samples. There is one important fix and other minor changes.