File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change 11let src = Logs.Src. create " storage"
22
33module Logs = (val Logs. src_log src : Logs.LOG )
4+ module Fc = Abbs_future_combinators
45
56module Queue_time_histogram = Prmths. Histogram (struct
67 let spec = Prmths.Histogram_spec. of_list [ 0.01 ; 0.1 ; 0.25 ; 0.5 ; 1.0 ; 2.5 ; 5.0 ; 7.5 ; 10.0 ; 15.0 ]
@@ -33,11 +34,21 @@ let metrics Pgsql_pool.Metrics.{ num_conns; idle_conns; queue_time } =
3334
3435let on_connect idle_tx_timeout conn =
3536 Abbs_future_combinators. ignore
36- (let open Abb.Future.Infix_monad in
37- Pgsql_io.Prepared_stmt. execute
38- conn
39- Pgsql_io.Typed_sql. (
40- sql /^ Printf. sprintf " set idle_in_transaction_session_timeout='%s'" idle_tx_timeout)
37+ (let go () =
38+ let open Fc.Infix_result_monad in
39+ Pgsql_io.Prepared_stmt. execute
40+ conn
41+ Pgsql_io.Typed_sql. (
42+ sql /^ Printf. sprintf " set idle_in_transaction_session_timeout='%s'" idle_tx_timeout)
43+ >> = fun () ->
44+ Pgsql_io.Prepared_stmt. execute conn Pgsql_io.Typed_sql. (sql /^ " set lock_timeout='60s'" )
45+ >> = fun () ->
46+ Pgsql_io.Prepared_stmt. execute
47+ conn
48+ Pgsql_io.Typed_sql. (sql /^ " set statement_timeout='300s'" )
49+ in
50+ let open Abb.Future.Infix_monad in
51+ go ()
4152 >> = function
4253 | Ok () -> Abb.Future. return ()
4354 | Error (#Pgsql_io. err as err ) ->
You can’t perform that action at this time.
0 commit comments