Log long write transactions
This commit is contained in:
parent
e322921b10
commit
06af94e7a2
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
@ -364,10 +364,12 @@ public class SDSDatabaseStorage: SDSTransactable {
|
||||
#endif
|
||||
|
||||
let benchTitle = "Slow Write Transaction \(Self.owsFormatLogMessage(file: file, function: function, line: line))"
|
||||
let timeoutThreshold = DebugFlags.internalLogging ? 0.1 : 0.5
|
||||
|
||||
InstrumentsMonitor.measure(category: "db", parent: "write", name: Self.owsFormatLogMessage(file: file, function: function, line: line)) {
|
||||
do {
|
||||
try grdbStorage.write { transaction in
|
||||
Bench(title: benchTitle, logIfLongerThan: 0.1, logInProduction: DebugFlags.internalLogging) {
|
||||
Bench(title: benchTitle, logIfLongerThan: timeoutThreshold, logInProduction: true) {
|
||||
block(transaction.asAnyWrite)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user