burke / zeus

Boot any rails app in under a second.
MIT License
3.33k stars 231 forks source link

Add support for delayed feature loading #584

Closed metcalf closed 8 years ago

metcalf commented 8 years ago

Zeus currently only reports features once when the action it executes completes. Many of our actions spawn long running server processes in a new thread. These can subsequently require new files (especially if you're using an autoloader).

This PR adds support for calling Zeus::LoadTracking.add_feature or Zeus::LoadTracking.track_features_loaded_by after an action has run to report additional features to Zeus.

The implementation is a bit gross since it involves setting and clearing a global variable on Zeus::LoadTracking. Given that the existing interface relies on global state, I'm not really sure there's a good way around that.

metcalf commented 8 years ago

r? @ptarjan

This is an alternative to the implementation in https://github.com/burke/zeus/pull/580. I haven't waited for tests to pass since Travis has been painfully slow today but tests did pass locally.

metcalf commented 8 years ago

cc @ngroman since we were all talking about this earlier. Also happy to have you review if you prefer since you mentioned wanting to get a better feel for Zeus.

metcalf commented 8 years ago

OK @ptarjan: tests seem to be passing now and this is ready for review

ptarjan commented 8 years ago

lgtm

metcalf commented 8 years ago

I'm not going to wait for OS X tests to pass again since they take forever in the queue. Tests are passing locally.