Go-Birds: Resilient Database Initialisation & Metrics
Built this service to explore fault-tolerant patterns in Go, specifically handling dependency boot sequences. Instead of crashing on startup when a database is unavailable, the application uses an asynchronous background worker to handle initialisation via an automated exponential backoff retry loop. To prevent hanging queries and resource leaks, core database operations are bound by strict context timeouts. The service features a native health-check probe, thread-safe memory handling via an RWMutex, and Prometheus metrics tracking lifetime deletions alongside real-time database inventory levels.
The Forge Specs
- ✦ Fault Tolerance: Automated exponential backoff logic for asynchronous PostgreSQL connection handling on boot
- ✦ Resource Bounds: Strict context management on queries to prevent goroutine leaks and cascading failures
- ✦ Memory Safety: Thread-safe dependency injection utilising sync.RWMutex to prevent runtime data races
- ✦ Lifecycle Management: Decoupled service startup—the HTTP server remains available even while downstream dependencies are resolving
- ✦ Observability: Prometheus metrics endpoints designed for automated scraping, measuring absolute data volume and system events
- ✦ Middleware: Implementation of a custom standard-library Panic-Recovery wrapper to catch unhandled runtime panics
- ✦ Deployed: on Render (Cold starts may apply) with persistent storage