Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita27014a

Browse files
committed
fixup
1 parente83ac60 commita27014a

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

‎Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncConfig.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
4545
loading=true
4646
defer{ loading=false}
4747
dothrows(DaemonError){
48+
// TODO: Support selecting & deleting multiple sessions at once
4849
tryawait fileSync.deleteSessions(ids:[selection!])
50+
if fileSync.sessionState.isEmpty{
51+
// Last session was deleted, stop the daemon
52+
await fileSync.stop()
53+
}
4954
} catch{
5055
deleteError= error
5156
}
@@ -60,7 +65,7 @@ struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
6065
Divider()
6166
Button{
6267
Task{
63-
// TODO: Support pausing & resuming multipleselections
68+
// TODO: Support pausing & resuming multiplesessions at once
6469
switch selectedSession.status{
6570
case.paused:
6671
tryawait fileSync.resumeSessions(ids:[selectedSession.id])

‎Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncSessionModal.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ struct FileSyncSessionModal<VPN: VPNService, FS: FileSyncDaemon>: View {
8686
defer{ loading=false}
8787
dothrows(DaemonError){
8888
iflet existingSession{
89-
// TODO: Support selecting & deleting multiple sessions at once
9089
tryawait fileSync.deleteSessions(ids:[existingSession.id])
9190
}
9291
tryawait fileSync.createSession(

‎Coder-Desktop/Coder-DesktopTests/Util.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ class MockFileSyncDaemon: FileSyncDaemon {
4848
}
4949

5050
func createSession(localPath _:String, agentHost _:String, remotePath _:String)asyncthrows(DaemonError){}
51+
52+
func pauseSessions(ids _:[String])asyncthrows(VPNLib.DaemonError){}
53+
54+
func resumeSessions(ids _:[String])asyncthrows(VPNLib.DaemonError){}
5155
}
5256

5357
extensionInspection:@uncheckedSendable,@retroactiveInspectionEmissary{}

‎Coder-Desktop/VPNLib/FileSync/FileSyncDaemon.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public class MutagenDaemon: FileSyncDaemon {
7777
return
7878
}
7979
awaitrefreshSessions()
80+
if sessionState.isEmpty{
81+
logger.info("No sync sessions found on startup, stopping daemon")
82+
awaitstop()
83+
}
8084
}
8185
}
8286

‎Coder-Desktop/VPNLib/FileSync/FileSyncManagement.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ public extension MutagenDaemon {
1313
return
1414
}
1515
sessionState= sessions.sessionStates.map{FileSyncSession(state: $0)}
16-
if sessionState.isEmpty{
17-
logger.info("No sync sessions found")
18-
awaitstop()
19-
}
2016
}
2117

2218
func createSession(
@@ -61,7 +57,8 @@ public extension MutagenDaemon {
6157
}
6258

6359
func deleteSessions(ids:[String])asyncthrows(DaemonError){
64-
// Terminating sessions does not require prompting
60+
// Terminating sessions does not require prompting, according to the
61+
// Mutagen CLI
6562
let(stream, promptID)=tryawaithost(allowPrompts:false)
6663
defer{ stream.cancel()}
6764
guard case.running= stateelse{return}
@@ -79,7 +76,9 @@ public extension MutagenDaemon {
7976
}
8077

8178
func pauseSessions(ids:[String])asyncthrows(DaemonError){
82-
let(stream, promptID)=tryawaithost()
79+
// Pausing sessions does not require prompting, according to the
80+
// Mutagen CLI
81+
let(stream, promptID)=tryawaithost(allowPrompts:false)
8382
defer{ stream.cancel()}
8483
guard case.running= stateelse{return}
8584
do{
@@ -96,7 +95,9 @@ public extension MutagenDaemon {
9695
}
9796

9897
func resumeSessions(ids:[String])asyncthrows(DaemonError){
99-
let(stream, promptID)=tryawaithost()
98+
// Resuming sessions does not require prompting, according to the
99+
// Mutagen CLI
100+
let(stream, promptID)=tryawaithost(allowPrompts:false)
100101
defer{ stream.cancel()}
101102
guard case.running= stateelse{return}
102103
do{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp