Commit 2614febc authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Correctly handle context cancellation in single-statement database operations.

parent 0a6049d8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ All notable changes to this project are documented below.
The format is based on [keep a changelog](http://keepachangelog.com) and this project uses [semantic versioning](http://semver.org).

## [Unreleased]
### Fixed
- Correctly handle context cancellation in single-statement database operations.

## [2.1.3] - 2018-11-02
### Added
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ func StatusError(code codes.Code, msg string, cause error) error {
// Retry functions that perform non-transactional database operations.
func ExecuteRetryable(fn func() error) error {
	if err := fn(); err != nil {
		if pqErr, ok := err.(*pq.Error); ok && pqErr.Code == "CR000" || pqErr.Code == "40001" {
		if pqErr, ok := err.(*pq.Error); ok && (pqErr.Code == "CR000" || pqErr.Code == "40001") {
			// A recognised error type that can be retried.
			return ExecuteRetryable(fn)
		}