Skip to content

Commit 660e1df

Browse files
committed
set generous timeouts on session requests
1 parent 2f056c5 commit 660e1df

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Coder-Desktop/VPNLib/FileSync/FileSyncDaemon.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public class MutagenDaemon: FileSyncDaemon {
4343
private let mutagenDataDirectory: URL
4444
private let mutagenDaemonSocket: URL
4545

46+
// Managing sync sessions can take a while, especially with prompting
47+
let sessionMgmtReqTimeout: TimeAmount = .seconds(5)
48+
4649
// Non-nil when the daemon is running
4750
var client: DaemonClient?
4851
private var group: MultiThreadedEventLoopGroup?

Coder-Desktop/VPNLib/FileSync/FileSyncManagement.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import NIOCore
2+
13
public extension MutagenDaemon {
24
func refreshSessions() async {
35
guard case .running = state else { return }
@@ -49,7 +51,7 @@ public extension MutagenDaemon {
4951
}
5052
}
5153
do {
52-
_ = try await client!.sync.create(req)
54+
_ = try await client!.sync.create(req, callOptions: .init(timeLimit: .timeout(sessionMgmtReqTimeout)))
5355
} catch {
5456
throw .grpcFailure(error)
5557
}
@@ -68,7 +70,7 @@ public extension MutagenDaemon {
6870
req.selection = .with { selection in
6971
selection.specifications = ids
7072
}
71-
})
73+
}, callOptions: .init(timeLimit: .timeout(sessionMgmtReqTimeout)))
7274
} catch {
7375
throw .grpcFailure(error)
7476
}
@@ -87,7 +89,7 @@ public extension MutagenDaemon {
8789
req.selection = .with { selection in
8890
selection.specifications = ids
8991
}
90-
})
92+
}, callOptions: .init(timeLimit: .timeout(sessionMgmtReqTimeout)))
9193
} catch {
9294
throw .grpcFailure(error)
9395
}
@@ -106,7 +108,7 @@ public extension MutagenDaemon {
106108
req.selection = .with { selection in
107109
selection.specifications = ids
108110
}
109-
})
111+
}, callOptions: .init(timeLimit: .timeout(sessionMgmtReqTimeout)))
110112
} catch {
111113
throw .grpcFailure(error)
112114
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy