Browse Source

Set gen_server-timeouts for transaction statements to infinity (#91)

Emil Falk 6 years ago
parent
commit
44ba1eb102
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/mysql.erl

+ 3 - 3
src/mysql.erl

@@ -383,13 +383,13 @@ transaction(Conn, Fun, Args, Retries) when is_list(Args),
                                            is_function(Fun, length(Args)) ->
     %% The guard makes sure that we can apply Fun to Args. Any error we catch
     %% in the try-catch are actual errors that occurred in Fun.
-    ok = gen_server:call(Conn, start_transaction),
+    ok = gen_server:call(Conn, start_transaction, infinity),
     execute_transaction(Conn, Fun, Args, Retries).
 
 execute_transaction(Conn, Fun, Args, Retries) ->
     try apply(Fun, Args) of
         ResultOfFun ->
-            ok = gen_server:call(Conn, commit),
+            ok = gen_server:call(Conn, commit, infinity),
             {atomic, ResultOfFun}
     catch
         %% We are at the top level, try to restart the transaction if there are
@@ -411,7 +411,7 @@ execute_transaction(Conn, Fun, Args, Retries) ->
             erlang:raise(error, E, ?GET_STACK(Stacktrace));
         ?EXCEPTION(Class, Reason, Stacktrace) ->
             %% We must be able to rollback. Otherwise let's crash.
-            ok = gen_server:call(Conn, rollback),
+            ok = gen_server:call(Conn, rollback, infinity),
             %% These forms for throw, error and exit mirror Mnesia's behaviour.
             Aborted = case Class of
                 throw -> {throw, Reason};