class

AptLarder::Server

Inherits Reference / Object

Owns the full lifecycle of one server run: cache, proxy, HTTP listener, background loops (eviction, stats) and graceful shutdown.

Usage: server = Server.new(config) Signal::TERM.trap { server.stop } server.start # blocks until stop is called and all requests drain

Constants

Log = ::Log.for("apt-larder.server")
SHUTDOWN_DRAIN_TIMEOUT = 30.seconds

Maximum time to wait for in-flight requests to drain on shutdown before returning anyway. Keep below systemd's default TimeoutStopSec (90s).

Constructors

new(config : Config)

Builds all shared objects (cache, single-flight, proxy) from config. No I/O happens here; start does the actual binding.

Source

Instance methods

start

Starts the HTTP server and blocks until stop is called. Waits for all in-flight requests to finish before returning.

Source
stop

Stops accepting new connections. start will return once in-flight requests finish.

Source