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

Prevent multiple reloads #22

Open
adamchainz opened this issue Dec 19, 2021 · 6 comments
Open

Prevent multiple reloads #22

adamchainz opened this issue Dec 19, 2021 · 6 comments

Comments

@adamchainz
Copy link
Owner

On my DB Buddy project I'm seeing many reloads for a single file changes. It looks like watchman is signalling the same file changing repeatedly.

Maybe something needs changing in this project, or we need to add debounce logic.

adamchainz added a commit that referenced this issue Dec 20, 2021
Will possibly help deduplicate. Doesn't help with #22.
@Mte90
Copy link

Mte90 commented Nov 8, 2023

Any updates for the debounce? I see that with LSP and tools that lint the code the page get multiple reloads.

@adamchainz
Copy link
Owner Author

There’s a 50ms denounce:

RELOAD_DEBOUNCE_TIME = 0.05 # seconds

can you try adjusting that in your project to see if it helps? Maybe we can make it configurable.

@Mte90
Copy link

Mte90 commented Nov 8, 2023

As I can see avdon't works, I changed to 10 seconds instead the refresh is like fast.
Maybe because runserver refresh for all of them?

@adamchainz
Copy link
Owner Author

Ah right, if runserver restarts, the debounce does not apply. Can you describe your situation a bit more? Is your runserver restarting multiple times?

@Mte90
Copy link

Mte90 commented Nov 9, 2023

Yes runserver restart multiple times because I have pylint/pydocstyle and so on that on every save change the file so runserver is execute multiple times.
Maybe is better a queue in runserver?

@adamchainz
Copy link
Owner Author

That would need implementing in Django itself.

we could perhaps add a debounce on the JavaScript side for restart events only. Would you like to give that a try?

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

No branches or pull requests

2 participants