rksm / hot-lib-reloader-rs

Reload Rust code without app restarts. For faster feedback cycles.
MIT License
577 stars 21 forks source link

Documentation does not mention that hot reloader only checks for reload if you call a function (at least once?) #21

Closed chamons closed 1 year ago

chamons commented 1 year ago

While retrofiring my project to use hot-lib-reloader-rs I ran into a very confusing issue, the notification from wait_for_about_to_reload never came back to me. I spent 2 hours comparing my project to the sample, refactoring, debugging, etc.

It turns out that if you don't call into any function in your hot reload API consistently (or at least once?) you don't get any notification.

My use case involves waiting for a reload, and then doing a bunch of work. I was not calling any API before the notification.

Once I created an empty API that I called in my message loop everything started working.

I'm filing this to suggest a documentation change to explain how\when the listening occurs.

rksm commented 1 year ago

Thank you, let me look into this.

rksm commented 1 year ago

Thank you for the report. This was indeed not intentional and has been fixed in 0.6.3. The wait function should always return if the library was reloaded, no matter if a call into it was made or not.

chamons commented 1 year ago

Thanks for the super quick turn around!