nikita-volkov / hasql-transaction

A composable abstraction over retriable transactions for Hasql
http://hackage.haskell.org/package/hasql-transaction
MIT License
12 stars 15 forks source link

Support for non-retryable transactions #22

Open steve-chavez opened 1 month ago

steve-chavez commented 1 month ago

Currently hasql-transaction retries infinitely on code 40001 , this causes problems on replicas as mentioned on https://github.com/PostgREST/postgrest/issues/3673.

Would it be possible to make the retrying behavior on both 40001 and 40P01 optional?

This is done here https://github.com/nikita-volkov/hasql-transaction/blob/2a9a710bd6230cb0abae84f14f852ab14fc3fa85/library/Hasql/Transaction/Private/Sessions.hs#L48-L49

nikita-volkov commented 1 month ago

I guess the functions that execute transactions can be parameterized with a configuration of how error codes should be handled. PR is welcome