Add context cancellation support to database operations
- Add context-aware versions of all read operations in the database - Update handlers to use context from HTTP requests - Allows database queries to be cancelled when HTTP requests timeout - Prevents database operations from continuing after client disconnects
This commit is contained in:
@@ -19,6 +19,7 @@ func logSlowQuery(logger *logger.Logger, query string, start time.Time) {
|
||||
}
|
||||
|
||||
// queryRow wraps QueryRow with slow query logging
|
||||
// nolint:unused // kept for consistency with other query wrappers
|
||||
func (d *Database) queryRow(query string, args ...interface{}) *sql.Row {
|
||||
start := time.Now()
|
||||
defer logSlowQuery(d.logger, query, start)
|
||||
|
||||
Reference in New Issue
Block a user