From a60bd10c3783b419a442d8c6e416975ebe29e7aa Mon Sep 17 00:00:00 2001
From: joshemb <josh@elixxir.io>
Date: Wed, 14 Sep 2022 14:08:54 -0700
Subject: [PATCH] Clean up documentation

---
 bindings/follow.go      | 14 ++++++++++++--
 fileTransfer/manager.go |  5 ++---
 stoppable/multi.go      |  4 +++-
 xxdk/cmix.go            |  5 +++--
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/bindings/follow.go b/bindings/follow.go
index 892a6311d..362ace98f 100644
--- a/bindings/follow.go
+++ b/bindings/follow.go
@@ -136,8 +136,18 @@ func (c *Cmix) IsHealthy() bool {
 	return c.api.GetCmix().IsHealthy()
 }
 
-// GetRunningProcesses returns the name of all running processes at the time
-// of this call.
+// GetRunningProcesses returns the names of all running processes at the time
+// of this call. Note that this list may change and is subject to race
+// conditions if multiple threads are in the process of starting or stopping.
+//
+// Returns:
+//  - []byte - A JSON marshalled list of all running processes.
+//
+// JSON Example:
+//  {
+//   "FileTransfer{BatchBuilderThread, FilePartSendingThread#0, FilePartSendingThread#1, FilePartSendingThread#2, FilePartSendingThread#3}",
+//   "MessageReception Worker 0"
+//  }
 func (c *Cmix) GetRunningProcesses() ([]byte, error) {
 	return json.Marshal(c.api.GetRunningProcesses())
 }
diff --git a/fileTransfer/manager.go b/fileTransfer/manager.go
index 6adcdc51a..549a9a799 100644
--- a/fileTransfer/manager.go
+++ b/fileTransfer/manager.go
@@ -219,8 +219,8 @@ func (m *manager) StartProcesses() (stoppable.Stoppable, error) {
 	batchBuilderStop := stoppable.NewSingle(batchBuilderThreadStoppable)
 
 	// Start sending threads
-	// Note that the startSendingWorkerPool creates go routines for over worker
-	// As a result, there is no need to run it asynchronously. In fact,
+	// Note that the startSendingWorkerPool already creates thread for every
+	// worker. As a result, there is no need to run it asynchronously. In fact,
 	// running this asynchronously could result in a race condition where
 	// some worker threads are not added to senderPoolStop before that stoppable
 	// is added to the multiStoppable.
@@ -229,7 +229,6 @@ func (m *manager) StartProcesses() (stoppable.Stoppable, error) {
 
 	// Create a multi stoppable
 	multiStoppable := stoppable.NewMulti(fileTransferStoppable)
-	jww.DEBUG.Printf("Adding sender pool w/ name %s", senderPoolStop.Name())
 	multiStoppable.Add(senderPoolStop)
 	multiStoppable.Add(batchBuilderStop)
 
diff --git a/stoppable/multi.go b/stoppable/multi.go
index e7e40ce5c..3ac77c750 100644
--- a/stoppable/multi.go
+++ b/stoppable/multi.go
@@ -76,7 +76,9 @@ func (m *Multi) GetStatus() Status {
 	return lowestStatus
 }
 
-// GetRunningProcesses returns a list of running Stoppable processes.
+// GetRunningProcesses returns the names of all running processes at the time
+// of this call. Note that this list may change and is subject to race
+// conditions if multiple threads are in the process of starting or stopping.
 func (m *Multi) GetRunningProcesses() []string {
 	m.mux.RLock()
 
diff --git a/xxdk/cmix.go b/xxdk/cmix.go
index b3f5e5bd4..a2b8b8b9a 100644
--- a/xxdk/cmix.go
+++ b/xxdk/cmix.go
@@ -397,8 +397,9 @@ func (c *Cmix) HasRunningProcessies() bool {
 	return !c.followerServices.stoppable.IsStopped()
 }
 
-// GetRunningProcesses returns the name of all running processes at the time
-// of this call.
+// GetRunningProcesses returns the names of all running processes at the time
+// of this call. Note that this list may change and is subject to race
+// conditions if multiple threads are in the process of starting or stopping.
 func (c *Cmix) GetRunningProcesses() []string {
 	return c.followerServices.stoppable.GetRunningProcesses()
 }
-- 
GitLab