Skip to content

Add a hot reloading RIE side implementation #7

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

Merged
merged 6 commits into from
Dec 13, 2022
Merged

Conversation

dfangl
Copy link
Member

@dfangl dfangl commented Dec 7, 2022

Motivation

We want to provide hot reloading to be able to mount a volume into the container and see changes as they happen. For this, once a change happens, we have to reset the infrastructure, to support reloading (for example, a loaded python module will not change if the source changes, we have to reload it / restart the interpreter).

Changes

  • Add recursive filewatcher for the /var/task folder, to be alerted if something changes
  • Add a debounced function to reload 500ms after last file change (to prevent too many restarts due to massive file changes)

Todos

  • Check functionality on windows and mac, and add polling mode if necessary
  • Add separate env variables to watch /var/task and /opt respectively? Or a even better, a list of to-be-watched directories.

Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to this feature! 😁

Added a few nits and suggestions.

Especially the main logic block in RunFileWatcher would benefit a lot from deconstructing it into smaller functions and introducing a struct for the filewatcher.

A few other suggestions for now:

  • separate the debounce from the actual consumption/processing of the changes for more clarity (e.g. the debounce itself could be a wrapper around the channel)
  • prefer passing a context instead of a channel for signaling exit/done

@dominikschubert dominikschubert self-requested a review December 13, 2022 09:19
Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit/suggestion, otherwise LGTM

@dfangl dfangl marked this pull request as ready for review December 13, 2022 16:19
@dfangl dfangl merged commit afe23d0 into localstack Dec 13, 2022
@dfangl dfangl deleted the hot-reloading branch December 13, 2022 16:56
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