Skip to content

Commit

Permalink
Comment updates (#11)
Browse files Browse the repository at this point in the history
* removed unused code

* comment update
  • Loading branch information
DiscoRiver authored May 6, 2022
1 parent faac7fe commit 39426cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
12 changes: 11 additions & 1 deletion omnivore/omnivore.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ type OmniCommandFlags struct {
func Run(cmd *OmniCommandFlags) {
ui.MakeDP()

// Used to avoid race condition in UI initialisation.
/*
Used to avoid race condition in UI initialisation.
Essentially, we need to populate the ossh StreamCycle before starting the UI due to pointer logic. Additionally,
once the UI is started, it can be cumbersome to process single line errors when closing the app, so if anything
goes wrong with the job initialisation, we can just print a failure without needing to handle any UI closures.
safeToStartUI should indicate that StreamCycle was successfully populated.
uiStarted should indicate when the UI is functional, so we can start refreshing it.
*/
safeToStartUI := make(chan struct{}, 1)
uiStarted := make(chan struct{}, 1)

Expand Down
17 changes: 0 additions & 17 deletions omnivore/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,3 @@ func readStreamWithTimeout(res massh.Result, t time.Duration, grp *group.ValueGr
}
}
}

// Read Stdout stream
func readStream(res massh.Result, grp *group.ValueGrouping, wg *sync.WaitGroup) {
for {
select {
case d := <-res.StdOutStream:
grp.AddToGroup(group.NewIdentifyingPair(res.Host, d))
case e := <-res.StdErrStream:
grp.AddToGroup(group.NewIdentifyingPair(res.Host, e))
case <-res.DoneChannel:
// Confirm that the remote command has finished.
ui.DP.StreamCycle.AddCompletedHost(res.Host)
wg.Done()
return
}
}
}

0 comments on commit 39426cf

Please sign in to comment.