Skip to content
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

Fix infinity loop #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix infinity loop #9

wants to merge 2 commits into from

Conversation

FckYeah
Copy link

@FckYeah FckYeah commented Oct 3, 2016

Sometimes left point greater than right point (and I don't know why). Those intervals will be added to leftIntervals instead of rightIntervals. And it will repeat again and again in line #303.

@mikolalysenko
Copy link
Owner

This sounds like it might be an error in the input. Can you post an example that reproduces this behavior?

@FckYeah
Copy link
Author

FckYeah commented Oct 3, 2016

Sure.
I use your library as a part of a complicated system. At the beginning I initialize empty tree. After that I generate batch of intervals and insert it to the tree one by one. I logged last values that causing infinity loops. Something like this:

import IntervalTree from 'interval-tree-1d';

const tree = new IntervalTree(null);
tree.insert([1475539200000, 1475578800000]);
tree.insert([1475600400000, 1475625599999]);
tree.insert([1475625600000, 1475643600000]);
tree.insert([1475665200000, 1475711999999]);
tree.insert([1475712000000, 1475751600000]);
tree.insert([1475773200000, 1475798399999]);
tree.insert([1475798400000, 1475816400000]);
tree.insert([1475838000000, 1475884799999]);
tree.insert([1475884800000, 1475924400000]);
tree.insert([1475946000000, 1475971199999]);
tree.insert([1475820000000, 1475823600000]);
tree.insert([1475827200000, 1475830800000]);
tree.insert([1475928000000, 1475931600000]);
tree.insert([1475823600000, 1475826300000]);
tree.insert([1475452800000, 1475539199999]);
tree.insert([1475971200000, 1476057599999]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants