Priority: P1
Source
Senior Architect Code Review (2026-04-03)
Problem
The Rust indexer uses a single tokio_postgres client connection with no reconnection logic or connection pooling. If the database connection drops (network blip, Cloud SQL restart, maintenance window), the indexer crashes and requires a full container restart.
The current code spawns the connection task and logs errors but does not attempt recovery:
tokio::spawn(async move {
if let Err(error) = connection.await {
eprintln!("postgres connection error: {error}");
}
});
Affected Files
apps/indexer/src/main.rs (Database struct)
Recommendation
Replace the bare tokio_postgres client with a connection pool such as deadpool-postgres or bb8-postgres. These handle:
- Automatic reconnection on connection loss
- Connection health checking
- Configurable pool size for concurrent package pollers
- Graceful degradation during database outages
Alternatively, wrap the existing client in a reconnection loop that detects connection failures and re-establishes the connection before retrying.
Acceptance Criteria
Priority: P1
Source
Senior Architect Code Review (2026-04-03)
Problem
The Rust indexer uses a single
tokio_postgresclient connection with no reconnection logic or connection pooling. If the database connection drops (network blip, Cloud SQL restart, maintenance window), the indexer crashes and requires a full container restart.The current code spawns the connection task and logs errors but does not attempt recovery:
Affected Files
apps/indexer/src/main.rs(Databasestruct)Recommendation
Replace the bare
tokio_postgresclient with a connection pool such asdeadpool-postgresorbb8-postgres. These handle:Alternatively, wrap the existing client in a reconnection loop that detects connection failures and re-establishes the connection before retrying.
Acceptance Criteria