Documentation
¶
Overview ¶
Deferred-init example.
Demonstrates keeping the health listener live while long-running bootstrap work runs in the background. Application routes return 503 until bootstrap and the OnReady hook both succeed, then the server flips to ready.
Run it:
go run ./examples/deferred-init
Then in another shell:
curl -i http://localhost:9080/healthz/ # 200 immediately curl -i http://localhost:9080/readyz/ # 503, then 200 curl -i http://localhost:8080/api/users # 503 until ready (~3s), then 200
Click to show internal directories.
Click to hide internal directories.