@@ -2547,7 +2547,7 @@ func maskPassword(dbURL string) (string, error) {
25472547/******* RETRIER ********/
25482548/*******************************/
25492549
2550- func isRetryablePGError (err error ) bool {
2550+ func isRetryablePGError (err error , logger * slog. Logger ) bool {
25512551 if err == nil {
25522552 return false
25532553 }
@@ -2557,6 +2557,9 @@ func isRetryablePGError(err error) bool {
25572557 // This is only retryable if the caller retries with a new transaction object.
25582558 // Otherwise, retrying with the same closed transaction will always fail.
25592559 if errors .Is (err , pgx .ErrTxClosed ) {
2560+ if logger != nil {
2561+ logger .Warn ("Transaction is closed, retrying requires a new transaction object" , "error" , err )
2562+ }
25602563 return true
25612564 }
25622565
@@ -2600,7 +2603,7 @@ type retryConfig struct {
26002603 backoffFactor float64
26012604 jitterMin float64
26022605 jitterMax float64
2603- retryCondition func (error ) bool
2606+ retryCondition func (error , * slog. Logger ) bool
26042607 logger * slog.Logger
26052608}
26062609
@@ -2644,7 +2647,7 @@ func withRetrierJitter(min, max float64) retryOption {
26442647}
26452648
26462649// withRetrierCondition sets the function that determines if an error is retryable
2647- func withRetrierCondition (condition func (error ) bool ) retryOption {
2650+ func withRetrierCondition (condition func (error , * slog. Logger ) bool ) retryOption {
26482651 return func (c * retryConfig ) {
26492652 c .retryCondition = condition
26502653 }
@@ -2693,7 +2696,7 @@ func retry(ctx context.Context, fn func() error, options ...retryOption) error {
26932696 }
26942697
26952698 // Check if error is retryable
2696- if ! config .retryCondition (lastErr ) {
2699+ if ! config .retryCondition (lastErr , config . logger ) {
26972700 if config .logger != nil {
26982701 config .logger .Debug ("Non-retryable error encountered" , "error" , lastErr )
26992702 }
0 commit comments