MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Stop

Method Stop

pkg/devspace/sync/sync.go:413–458  ·  view source on GitHub ↗

Stop stops the sync process

(fatalError error)

Source from the content-addressed store, hash-verified

411
412// Stop stops the sync process
413func (s *Sync) Stop(fatalError error) {
414 s.stopOnce.Do(func() {
415 s.cancelCtx()
416 if s.upstream != nil {
417 for _, symlink := range s.upstream.symlinks {
418 symlink.Stop()
419 }
420 if s.upstream.writer != nil {
421 s.upstream.writer.Close()
422 }
423 if s.upstream.reader != nil {
424 s.upstream.reader.Close()
425 }
426 if s.upstream.conn != nil {
427 s.upstream.conn.Close()
428 }
429 }
430
431 if s.downstream != nil {
432 if s.downstream.writer != nil {
433 s.downstream.writer.Close()
434 }
435 if s.downstream.reader != nil {
436 s.downstream.reader.Close()
437 }
438 if s.downstream.conn != nil {
439 s.downstream.conn.Close()
440 }
441 }
442
443 if fatalError != nil {
444 s.Error(fatalError)
445
446 // This needs to be rethought because we do not always kill the application here, would be better to have an error channel
447 // or runtime error here
448 if s.onError != nil {
449 s.onError <- fatalError
450 }
451 }
452
453 s.log.Debugf("Sync stopped")
454 if s.onDone != nil {
455 close(s.onDone)
456 }
457 })
458}

Callers 4

initClientMethod · 0.95
mainLoopMethod · 0.95
startUpstreamMethod · 0.95
startDownstreamMethod · 0.95

Calls 5

ErrorMethod · 0.95
closeFunction · 0.85
StopMethod · 0.65
CloseMethod · 0.65
DebugfMethod · 0.45

Tested by

no test coverage detected