IsSerializationRelatedError checks if the error is a serialization failure, typically in database transactions.
(err error)
| 158 | |
| 159 | // IsSerializationRelatedError checks if the error is a serialization failure, typically in database transactions. |
| 160 | func IsSerializationRelatedError(err error) bool { |
| 161 | if strings.Contains(err.Error(), "could not serialize") || |
| 162 | strings.Contains(err.Error(), "duplicate key value") { |
| 163 | return true |
| 164 | } |
| 165 | return false |
| 166 | } |
| 167 | |
| 168 | // WaitWithBackoff implements an exponential backoff strategy with jitter for retries. |
| 169 | // It waits for a calculated duration or until the context is cancelled, whichever comes first. |
no test coverage detected