From a08f21336a2c3b9a9935fe2db1b1de0ca9e9be2d Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Fri, 17 Jul 2020 10:26:30 -0400 Subject: [PATCH] Be explicit about transaction management. --- .../java/org/whispersystems/textsecuregcm/storage/Messages.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Messages.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Messages.java index 8da33888f..3b9b3b49c 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Messages.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Messages.java @@ -52,7 +52,7 @@ public class Messages { } public void store(List messages, String destination, long destinationDevice) { - database.use(jdbi -> jdbi.useHandle(handle -> { + database.use(jdbi -> jdbi.useTransaction(handle -> { try (Timer.Context ignored = storeTimer.time()) { final PreparedBatch batch = handle.prepareBatch("INSERT INTO messages (" + GUID + ", " + TYPE + ", " + RELAY + ", " + TIMESTAMP + ", " + SERVER_TIMESTAMP + ", " + SOURCE + ", " + SOURCE_UUID + ", " + SOURCE_DEVICE + ", " + DESTINATION + ", " + DESTINATION_DEVICE + ", " + MESSAGE + ", " + CONTENT + ") " + "VALUES (:guid, :type, :relay, :timestamp, :server_timestamp, :source, :source_uuid, :source_device, :destination, :destination_device, :message, :content)");