diff --git a/SignalMessaging/Notifications/UserNotificationsAdaptee.swift b/SignalMessaging/Notifications/UserNotificationsAdaptee.swift index d6bb15023f..51e70325e1 100644 --- a/SignalMessaging/Notifications/UserNotificationsAdaptee.swift +++ b/SignalMessaging/Notifications/UserNotificationsAdaptee.swift @@ -1,5 +1,5 @@ // -// Copyright (c) 2021 Open Whisper Systems. All rights reserved. +// Copyright (c) 2022 Open Whisper Systems. All rights reserved. // import Foundation @@ -250,9 +250,7 @@ class UserNotificationPresenterAdaptee: NSObject, NotificationPresenterAdaptee { let request = UNNotificationRequest(identifier: notificationIdentifier, content: contentToUse, trigger: trigger) - if DebugFlags.internalLogging { - Logger.info("presenting notification with identifier: \(notificationIdentifier)") - } + Logger.info("presenting notification with identifier: \(notificationIdentifier)") notificationCenter.add(request) { (error: Error?) in if let error = error { owsFailDebug("Error: \(error)") diff --git a/SignalNSE/NotificationService.swift b/SignalNSE/NotificationService.swift index 14bd3a76fb..1554493d4b 100644 --- a/SignalNSE/NotificationService.swift +++ b/SignalNSE/NotificationService.swift @@ -206,6 +206,7 @@ class NotificationService: UNNotificationServiceExtension { runningAndCompletedPromises.append(("MessageProcessorCompletion", promise)) return promise }.then(on: .global()) { () -> Promise in + Logger.info("Initial message processing complete.") // Wait until all async side effects of // message processing are complete. let completionPromises: [(String, Promise)] = [ @@ -220,7 +221,11 @@ class NotificationService: UNNotificationServiceExtension { // Wait until all sync requests are fulfilled. ("Pending sync request", OWSMessageManager.pendingTasksPromise()) ] - let joinedPromise = Promise.when(resolved: completionPromises.map { $0.1 }) + let joinedPromise = Promise.when(resolved: completionPromises.map { (name, promise) in + promise.done(on: .global()) { + Logger.info("\(name) complete") + } + }) completionPromises.forEach { runningAndCompletedPromises.append($0) } return joinedPromise.asVoid() } diff --git a/SignalServiceKit/src/Network/OWSURLSession.swift b/SignalServiceKit/src/Network/OWSURLSession.swift index b417b16be9..cf5f174dba 100644 --- a/SignalServiceKit/src/Network/OWSURLSession.swift +++ b/SignalServiceKit/src/Network/OWSURLSession.swift @@ -806,6 +806,11 @@ extension OWSURLSession: URLSessionDownloadDelegate { completionHandler(.cancel) return } + if response.expectedContentLength > 800_000 { + let formattedContentLength = OWSFormat.formatFileSize(UInt(response.expectedContentLength)) + let urlString = response.url.map { String(describing: $0) } ?? "" + Logger.warn("Large response (\(formattedContentLength)) for \(urlString)") + } completionHandler(.allow) } diff --git a/SignalServiceKit/src/Util/LocalDevice.swift b/SignalServiceKit/src/Util/LocalDevice.swift index fc5900359a..4b49635654 100644 --- a/SignalServiceKit/src/Util/LocalDevice.swift +++ b/SignalServiceKit/src/Util/LocalDevice.swift @@ -60,12 +60,12 @@ public class LocalDevice: NSObject { mallocAllocations: Int64(statistics.size_allocated) ) - if DebugFlags.internalLogging, CurrentAppContext().isNSE { + if CurrentAppContext().isNSE { if result.bytesRemaining > 0 { // If we're running out of free memory, let's start aggressively flushing // our log messages. This way, we don't lose any logs when we're suddenly terminated. // There's a perf cost here, but we're going to be killed soon anyway so it's not a big deal. - OWSLogger.aggressiveFlushing = result.bytesRemaining < (1024 * 1024) + OWSLogger.aggressiveFlushing = result.bytesRemaining < (4 * 1024 * 1024) } else { // The source of the remaining bits is fairly under documented. In my testing, things // seem to be working as expected. Just to be safe, let's interpret 0 free bytes as invalid