Be explicit about transaction management.
This commit is contained in:
parent
215125de26
commit
a08f21336a
|
@ -52,7 +52,7 @@ public class Messages {
|
|||
}
|
||||
|
||||
public void store(List<Envelope> 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)");
|
||||
|
|
Loading…
Reference in New Issue