raxx_kit icon indicating copy to clipboard operation
raxx_kit copied to clipboard

*Selectively* reload source files using exsync

Open nietaki opened this issue 6 years ago • 3 comments

Some files/modules are more safe/reasonable to reload while the application is running. Anything that's short-lived (request handlers, templates for example) is ok, but reloading slightly changed long-lived GenServers can break your app, maybe even in a hard to diagnose way.

This is a Proof of concept of selective reloading:

  • The example project with selective reloading enabled: https://github.com/nietaki/reloader
  • Relevant commit: https://github.com/nietaki/reloader/commit/0072084bc6ad519db35215759dba7da6d0aa4ec8
  • Changes I made to exsync: https://github.com/falood/exsync/compare/master...nietaki:selective-reloading?expand=1

The exsync tweak could probably be done more elegantly, but the changes I made were the least invasive - alternatives would probably require some more refactoring.

I checked on Ubuntu, OSX and inside the docker container - you can point at individual files and it still works.

nietaki avatar Nov 24 '18 18:11 nietaki

Looks sensible.

CrowdHailer avatar Nov 24 '18 23:11 CrowdHailer

@CrowdHailer Do you think this is a change that we could get into official exsync? Is there any adjustments you thing should be made first?

I'd rather not have raxx_kit generate projects pointing at a random branch in a random repo for one of the deps, feels a bit bootleg.

At the same time, there's a lot of variables involved with the code reloading stuff (umbrella projects, operating systems, unorthodox project layouts), maybe it makes sense to try it out for a while and iron out any problems first 🤷‍♂️

nietaki avatar Nov 25 '18 12:11 nietaki

I think it's possible. Certainly if you have found it useful open up a PR on ExSync where it can be discussed.

Raxx.kit is definitely best off pointing at a real release, if not when will people know to upgrade.

Re all the other variables, I think with ubuntu, osx and docker that's a reasonable start.

CrowdHailer avatar Nov 26 '18 09:11 CrowdHailer