Wytch::ReloadCoordinator

Coordinates hot reloading of site code and content during development.

Description

Coordinates hot reloading of site code and content during development.

The ReloadCoordinator watches the site code and content directories for changes using the Listen gem. When files change, it marks the appropriate component as dirty and reloads it on the next request.

It uses a read-write lock to ensure thread-safe reloading while allowing concurrent reads during page rendering.

Methods

def reload_lock

Returns:
(Concurrent::ReadWriteLock) — lock for coordinating reloads

def reload!

Reloads site code and/or content if changes have been detected.

Starts file listeners on first call. If site code has changed, reloads both site code (via Zeitwerk) and content. If only content has changed, reloads just the content.

Returns:
(void)