From 27f0b9b5b06ed02f01124929dd019fde18ec5ea8 Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sat, 11 Dec 2021 18:14:16 -0800 Subject: [PATCH] Nanoseconds --- Secretive/App.swift | 2 +- Secretive/Controllers/LaunchAgentController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Secretive/App.swift b/Secretive/App.swift index 6f46903..019ae0c 100644 --- a/Secretive/App.swift +++ b/Secretive/App.swift @@ -71,7 +71,7 @@ extension Secretive { Task { await LaunchAgentController().install() // Wait a second for launchd to kick in (next runloop isn't enough). - await Task.sleep(UInt64(Measurement(value: 1, unit: UnitDuration.seconds).converted(to: .nanoseconds).value)) + try? await Task.sleep(nanoseconds: UInt64(Measurement(value: 1, unit: UnitDuration.seconds).converted(to: .nanoseconds).value)) agentStatusChecker.check() if !agentStatusChecker.running { forceLaunchAgent() diff --git a/Secretive/Controllers/LaunchAgentController.swift b/Secretive/Controllers/LaunchAgentController.swift index dc558e9..efff338 100644 --- a/Secretive/Controllers/LaunchAgentController.swift +++ b/Secretive/Controllers/LaunchAgentController.swift @@ -12,7 +12,7 @@ struct LaunchAgentController { // This is definitely a bit of a "seems to work better" thing but: // Seems to more reliably hit if these are on separate runloops, otherwise it seems like it sometimes doesn't kill old // and start new? - await Task.sleep(UInt64(Measurement(value: 0.1, unit: UnitDuration.seconds).converted(to: .nanoseconds).value)) + try? await Task.sleep(nanoseconds: UInt64(Measurement(value: 0.1, unit: UnitDuration.seconds).converted(to: .nanoseconds).value)) _ = setEnabled(true) }