For external dependencies that are additive (e.g., mirrors/archives) rather than required for correctness, prefer fail-open behavior: log errors and continue operating using the primary source of truth. Reserve fail-fast for dependencies that are hard requirements for correctness or API functionality.
Practical rules:
Example (non-blocking additive sink):
onStartup():
try:
objectStoreClient = connect(config.objectStorage)
archivalEnabled = true
catch err:
log.error("object storage unreachable; continuing database-only", err)
archivalEnabled = false
writeAuditEvent(event):
dbWrite(event) // must always succeed for correctness
flushBatch(batch):
if not archivalEnabled: return
try:
objectStore.put(renderKey(batch), gzip(jsonl(batch)))
catch err:
log.error("archival upload failed; audit DB write already committed", err)
// do not fail request handling
Enter the URL of a public GitHub repository