Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Prevent yielding duplicated nodes from iterator #439

Merged
merged 8 commits into from
Feb 12, 2023

Conversation

akindyakov
Copy link
Contributor

@akindyakov akindyakov commented Feb 12, 2023

The problem of duplicates from node iterator comes from the fact that iterator is used as part of state being mutable object - every call to next() changes index in it. And in current version of SearchGrid iterator in state is never set explicitly, this is where most of the problems originates.

But there are more, another issue is that fetching callback can be called not exclusively. Meaning that there were multiple calls to it at the same time, which results in data race. I tried to solve this with throttling, but that didn't work very well. So I used a proper mutex now, from async-mutext package. Works like a charm.

Uploading Screen Recording 2023-02-12 at 16.53.19.mov…

Fixes #428

#351

@akindyakov akindyakov merged commit af187d2 into main Feb 12, 2023
@akindyakov akindyakov deleted the duplicates-from-node-iterator branch February 12, 2023 22:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Local mode: Node iterator created by storage.node.iterate() occasionally returns same node more than once
2 participants