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

Excessive restart with flet run , restart race can occur #3097

Closed
auphof opened this issue Apr 25, 2024 · 0 comments · Fixed by #3098
Closed

Excessive restart with flet run , restart race can occur #3097

auphof opened this issue Apr 25, 2024 · 0 comments · Fixed by #3098

Comments

@auphof
Copy link
Contributor

auphof commented Apr 25, 2024

Issue Description:

when i attempt to auto reload with flet run -d ./app --recursive a restart race commences when a file is modified or opened in a subdir below ./app . Even without --recursive file opens in ./app trigger a restart/reload

Environment

  1. Flet version: 0.22.0
  2. WSL2 with ubuntu 22.04
  3. IDE VSCODE v1.881
  4. HOST: Windows 11
    on a modification in recursive

Steps to Reproduce:

following setup

# -------------------------------------------------------- 
# Example_app folder tree view
# --------------------------------------------
# example_app
# ├── .gitignore
# └── app
#     ├── __init__.py
#     ├── main.py
#     └── components
#                ├── my_flet_controls.py
#                └── __init__.py

Now cd example_app and then execute the app with flet run -d ./app --recursive
modify /components/my_flet_controls.py in your ide and save will trigger a restart race. additionally just cat ./app/components/__init__.py will trigger a restart

with flet run -d ./app (NO --recursive) just a cat ./app/__init__.py will trigger a restart

Fix

in the flet run cli, Only restart if the watchdog event.event_type in ['modified','deleted','created','moved'] the handler is here
https://github.com/flet-dev/flet/blob/a7d7c86930fe70550589c9ba665997c440980f51/sdk/python/packages/flet/src/flet/cli/commands/run.py#L291C12-L291C69

I will raise a PR for this

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 a pull request may close this issue.

1 participant