mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: don't log disconnect error when the database is shutting down (#6309)
* fix: don't log disconnect error when the database is shutting down Seen in: https://github.com/coder/coder/actions/runs/4244980490/jobs/7379867681 * Generalize the query close error
This commit is contained in:
@@ -27,3 +27,13 @@ func IsUniqueViolation(err error, uniqueConstraints ...UniqueConstraint) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsQueryCanceledError checks if the error is due to a query being canceled.
|
||||
func IsQueryCanceledError(err error) bool {
|
||||
var pqErr *pq.Error
|
||||
if errors.As(err, &pqErr) {
|
||||
return pqErr.Code.Name() == "query_canceled"
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user