Wytch::SiteCodeLoaderMiddleware

Rack middleware that triggers hot reloading before each request.

Description

Rack middleware that triggers hot reloading before each request.

This middleware wraps the base application and coordinates with the ReloadCoordinator to ensure site code and content are reloaded when files change. It acquires a read lock during request processing to prevent reloads from interfering with rendering.

Methods

def call(env)

Handles a Rack request.

Triggers a reload check, then processes the request while holding a read lock to prevent concurrent reloads.

Parameters:
env (Hash) — the Rack environment
Returns:
(Array) — the Rack response tuple