To get a hot swap for code, it's hard to get right, if at all possible. It depends on the changeset and the running application.
Questions:
- old vars can interfere with namespaces and cause subtle conflicts, errors
- redefinition of several vars is not atomic
There may be old vars in the namespace, which will not exist if you restart the application, however this will interfere if you simply override some functions and save the application without rebooting.
Another problem is atomicity: redefinition of several functions, i.e. changing several vars is not atomic. If you change functions in one or more namespaces that depend on code in another namespace, reloading the namespaces with the new code is not atomic.
You are generally better off
- with a proxy server hold requests until your application reloads
- deploys a new instance of the application parallel to the "old version" and uses a proxy to switch from the new version after the new version is ready to process requests
source share