Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d4b37c7

Browse files
committed
structure
1 parent c753bf6 commit d4b37c7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

agent/agentcontainers/api.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ type API struct {
5353
cancel context.CancelFunc
5454
watcherDone chan struct{}
5555
updaterDone chan struct{}
56-
initDone chan struct{} // Closed after first update in updaterLoop.
5756
updateTrigger chan chan error // Channel to trigger manual refresh.
5857
updateInterval time.Duration // Interval for periodic container updates.
5958
logger slog.Logger
@@ -73,7 +72,8 @@ type API struct {
7372
workspaceName string
7473
parentAgent string
7574

76-
mu sync.RWMutex
75+
mu sync.RWMutex // Protects the following fields.
76+
initDone chan struct{} // Closed by Init.
7777
closed bool
7878
containers codersdk.WorkspaceAgentListContainersResponse // Output from the last list operation.
7979
containersErr error // Error from the last list operation.
@@ -322,7 +322,7 @@ func NewAPI(logger slog.Logger, options ...Option) *API {
322322
}
323323

324324
// Init applies a final set of options to the API and then
325-
// closes initDone. This function can only be called once.
325+
// closes initDone. This method can only be called once.
326326
func (api *API) Init(opts ...Option) {
327327
api.mu.Lock()
328328
defer api.mu.Unlock()

0 commit comments

Comments
 (0)