MCPcopy Index your code
hub / github.com/coder/coder / Start

Method Start

agent/agentcontainers/api.go:402–422  ·  view source on GitHub ↗

Start starts the API by initializing the watcher and updater loops. This method calls Init, if it is desired to apply options after the API has been created, it should be done by calling Init before Start. This method must only be called once.

()

Source from the content-addressed store, hash-verified

400// the API has been created, it should be done by calling Init before
401// Start. This method must only be called once.
402func (api *API) Start() {
403 api.Init()
404
405 api.mu.Lock()
406 defer api.mu.Unlock()
407 if api.closed {
408 return
409 }
410
411 if api.projectDiscovery && api.agentDirectory != "" {
412 api.discoverDone = make(chan struct{})
413
414 go api.discover()
415 }
416
417 api.watcherDone = make(chan struct{})
418 api.updaterDone = make(chan struct{})
419
420 go api.watcherLoop()
421 go api.updaterLoop()
422}
423
424func (api *API) discover() {
425 defer close(api.discoverDone)

Callers 5

TestAPIFunction · 0.95

Calls 6

InitMethod · 0.95
discoverMethod · 0.95
watcherLoopMethod · 0.95
updaterLoopMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 5

TestAPIFunction · 0.76