summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-23 22:09:47 -0500
committerJune McEnroe <june@causal.agency>2019-12-23 22:09:47 -0500
commit333673fc990e2677bb5d8a56808e4f4d25f3496e (patch)
tree72098e0fefab6891250d1d4c22d05c3a2c6a1daa
parentTake optional explicit path in dbFind (diff)
downloadlitterbox-333673fc990e2677bb5d8a56808e4f4d25f3496e.tar.gz
litterbox-333673fc990e2677bb5d8a56808e4f4d25f3496e.zip
Actually only use a transaction for handlers that need it
How did I manage that?
Diffstat (limited to '')
-rw-r--r--litterbox.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/litterbox.c b/litterbox.c
index 8015cec..39fce8f 100644
--- a/litterbox.c
+++ b/litterbox.c
@@ -368,9 +368,13 @@ static void handle(struct Message msg) {
 	if (!msg.cmd) return;
 	for (size_t i = 0; i < ARRAY_LEN(Handlers); ++i) {
 		if (strcmp(msg.cmd, Handlers[i].cmd)) continue;
-		dbExec(db, SQL(BEGIN TRANSACTION;));
-		Handlers[i].fn(&msg);
-		dbExec(db, SQL(COMMIT TRANSACTION;));
+		if (Handlers[i].transaction) {
+			dbExec(db, SQL(BEGIN TRANSACTION;));
+			Handlers[i].fn(&msg);
+			dbExec(db, SQL(COMMIT TRANSACTION;));
+		} else {
+			Handlers[i].fn(&msg);
+		}
 		break;
 	}
 }
2019-11-06Document calico service configurationJune McEnroe 2019-11-06Document SASL EXTERNAL configuration in more detailJune McEnroe 2019-11-06Document pounce service configurationJune McEnroe 2019-11-06Mention Darwin and GNU/Linux in READMEJune McEnroe 2019-11-06Assume LibreSSL from brew on DarwinJune McEnroe 2019-11-06Remove -DNO_EXPLICIT_BZERO from Darwin.mkJune McEnroe 2019-11-06Don't install rc scripts or dirs on LinuxJune McEnroe