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

Improve timeout handling #104

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

Conversation

mpfz0r
Copy link

@mpfz0r mpfz0r commented Nov 14, 2024

Register timeout before starting the algorithm
This allows the layout to be stopped in a more timely manner
on large networks.

Obey maxSimulationTime when not animated
If not animated (requestAnimationFrame),
the loop can never be interrupted by the maxSimulationTime timeout.
Solve this by running the layout in a timeout as well.

Marco Pfatschbacher added 3 commits November 14, 2024 21:08
This allows the layout to be stopped in a more timely manner
on large networks.
If not animated (requestAnimationFrame),
the loop can never be interrupted by the maxSimulationTime timeout.

Solve this by running the layout in a timeout as well.
Copy link

stale bot commented Nov 30, 2024

This issue has been automatically marked as stale, because it has not had activity within the past 30 days. It will be closed if no further activity occurs within the next 30 days. If a feature request is important to you, please consider making a pull request. Thank you for your contributions.

@stale stale bot added the stale label Nov 30, 2024
@mpfz0r
Copy link
Author

mpfz0r commented Nov 30, 2024

please consider making a pull request.

This is a pull request 🤷

@maxkfranz
Copy link
Member

Using setTimeout will slow down the performance of the layout when it's non-animated.

It would be better to monitor the time in the regular loop. It would also be a smaller change.

@stale stale bot removed the stale label Dec 2, 2024
@mpfz0r
Copy link
Author

mpfz0r commented Dec 3, 2024

The problem I'm trying to solve, is that with larger graphs (~1000 nodes) the timeout does not kick in at all when not animated.
I think this is because the single main thread is blocked until completion.

So instead of using a timeout at all you mean to keep checking the elapsed time in the loop and then exit once it exceeded the limit?

@maxkfranz
Copy link
Member

maxkfranz commented Dec 3, 2024 via email

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