microsoft/Windows-classic-samples

[Cloud Mirror] CF_CALLBACK_TYPE_FETCH_PLACEHOLDERS called multiple times

ddomingos-encora opened this issue · 1 comments

I'm trying to modify the Cloud Mirror sample to implement on demand population. I registered a new callback for type CF_CALLBACK_TYPE_FETCH_PLACEHOLDERS, changed the Population Policy to Full when registering the sync root folder and removed the creation of placeholders at initialization. What happens is that the new callback is called several times at the point to degrade Explore's performance, while it should be called only once per directory visited.

I found the same bug reported in stack overflow, but without any solution so I decided to report it here as well
https://stackoverflow.com/questions/63348568/cfapi-cf-callback-type-fetch-placeholders-calls-back-repeatedly

The author of this post even created a fork with the changes to reproduce the problem, which can be found here
https://github.com/legsak1mbo/VCCloudMirror/

I believe it is not based on the latest commit but I'm using the latest and the problem is still there. I can create a fork with my changes if needed.

I appreciate any help. Thanks

After reading the proposed solution in stackoverflow again, I managed to apply the workaround. At first, I thought the answer was suggesting to not use (disable) on-demand population in general but it was actually suggesting to disable it per folder visited (so I guess it could have been more clearer too).
The tricky is to use CF_OPERATION_TRANSFER_PLACEHOLDERS_FLAG_DISABLE_ON_DEMAND_POPULATION flag in the FetchPlaceholders callback. This will disable future callbacks to the specified folder (which means the callback will be called only once per folder, even if you navigate back to the same folder).
With that, you have to update your folders by other means (e.g websocket connection to server). Still, I think it would be good if it was possible to have the callback called each time you navigate to a folder (so you can update it) without having the bug of it being calling repeatedly