From df7f209ebc415fcaed527c8722f570401764771f Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Sun, 4 Oct 2020 15:06:06 -0400 Subject: [PATCH] Revert "Don't insert message batches in transactions." This reverts commit 16eefe333f0f2e140c713223bc50721d8826e796. --- .../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 d5b294810..97bc88384 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Messages.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Messages.java @@ -66,7 +66,7 @@ public class Messages { } public void store(final List messages, final String destination, final long destinationDevice) { - database.use(jdbi -> jdbi.useHandle(handle -> { + database.use(jdbi -> jdbi.useTransaction(handle -> { try (final 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)");