diff src/c/urweb.c @ 2178:c76a9712334c

Database-server reconnection for MySQL
author Adam Chlipala <adam@chlipala.net>
date Sat, 17 Oct 2015 11:31:22 -0400
parents 00cf8214c2e3
children d87d72b6e299 1e3ba868f8bf
line wrap: on
line diff
--- a/src/c/urweb.c	Sat Oct 17 11:08:12 2015 -0400
+++ b/src/c/urweb.c	Sat Oct 17 11:31:22 2015 -0400
@@ -813,7 +813,7 @@
 
 void uw_try_reconnecting_and_restarting(uw_context ctx) {
   uw_try_reconnecting(ctx);
-  uw_error(ctx, UNLIMITED_RETRY, "Restarting transaction after fixing database connection");
+  uw_error(ctx, BOUNDED_RETRY, "Restarting transaction after fixing database connection");
 }
 
 void uw_ensure_transaction(uw_context ctx) {
@@ -826,7 +826,8 @@
     }
 
     ctx->transaction_started = 1;
-  }
+  } else if (ctx->at_most_one_query && !ctx->db)
+    uw_try_reconnecting(ctx);
 }
 
 uw_Basis_client uw_Basis_self(uw_context ctx) {