Merge branch 'charlesmchen/dbReadPoolSize'

This commit is contained in:
Michelle Linington 2021-10-26 15:06:53 -07:00
commit a01734d6d4
3 changed files with 16 additions and 4 deletions

View File

@ -80,21 +80,21 @@ class NSEContext: NSObject, AppContext {
private func applicationWillResignActive(_ notification: NSNotification) {
AssertIsOnMainThread()
Logger.info("... memoryUsage: \(LocalDevice.memoryUsage)")
Logger.info("memoryUsage: \(LocalDevice.memoryUsage)")
}
@objc
private func applicationWillTerminate(_ notification: NSNotification) {
AssertIsOnMainThread()
Logger.info("... memoryUsage: \(LocalDevice.memoryUsage)")
Logger.info("memoryUsage: \(LocalDevice.memoryUsage)")
}
@objc
private func applicationDidReceiveMemoryWarning(_ notification: NSNotification) {
AssertIsOnMainThread()
Logger.info("... memoryUsage: \(LocalDevice.memoryUsage)")
Logger.info("memoryUsage: \(LocalDevice.memoryUsage)")
}
// MARK: - Unused in this extension

View File

@ -128,6 +128,7 @@ NSString *NSStringForOWSReceiptType(OWSReceiptType receiptType)
if (completion) {
completion();
}
[self logMemoryUsage];
return;
}
@ -141,6 +142,7 @@ NSString *NSStringForOWSReceiptType(OWSReceiptType receiptType)
if (completion) {
completion();
}
[self logMemoryUsage];
return;
}
@ -155,6 +157,7 @@ NSString *NSStringForOWSReceiptType(OWSReceiptType receiptType)
if (completion) {
completion();
}
[self logMemoryUsage];
return;
}
@ -181,6 +184,14 @@ NSString *NSStringForOWSReceiptType(OWSReceiptType receiptType)
});
}
- (void)logMemoryUsage {
if (SSKDebugFlags.internalLogging) {
dispatch_async(self.serialQueue, ^{
OWSLogVerbose(@"memoryUsage: %@", LocalDevice.memoryUsage);
});
}
}
- (NSArray<AnyPromise *> *)sendReceiptsForReceiptType:(OWSReceiptType)receiptType {
__block NSDictionary<SignalServiceAddress *, MessageReceiptSet *> *queuedReceiptMap;
[self.databaseStorage readWithBlock:^(SDSAnyReadTransaction *transaction) {

View File

@ -889,7 +889,8 @@ private struct GRDBStorage {
}
// Useful when your app opens multiple databases
configuration.label = "GRDB Storage"
configuration.maximumReaderCount = 10 // The default is 5
let isMainApp = CurrentAppContext().isMainApp
configuration.maximumReaderCount = isMainApp ? 10 : 5 // The default is 5
configuration.busyMode = .callback({ (retryCount: Int) -> Bool in
// sleep N milliseconds
let millis = 25