Hello, I wanted to summarize my thoughts on the next item on the 1.0 development roadmap, which is how we'll reload state in development environments. Because we now freeze app state on boot, our best and probably only option is to restart the process when something changes.
There are existing libraries out there, such as shotgun, that blindly restart the process on every request. Instead, I want to restart the process only when something changes. I wrote 25 lines of code to prototype the approach I want to take. The main process kills the current forked process when a file change occurs, then creates a new fork.
What's cool is that it loads bundler, pakyow, and the rest of the dependencies in the main process rather than the forked one. In my test app, reloads happen in less than 500ms after a file change. This is 2-3x faster than the initial boot time, because we don't have to reload dependencies on each restart.
This approach also gives us the opportunity to provide other insights to the developer, such as instructing them to run
db:migrate when a migration changes or to
bundle update after changing
Gemfile. I haven't explored it much, but we might be able to do these things automatically (or at least ask them if they want to).
Share any ideas you have to make this better! Here's an issue for this work: https://github.com/pakyow/pakyow/issues/219.