MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / doShutdown

Function doShutdown

cmd/server/main-server.go:78–97  ·  view source on GitHub ↗
(reason string)

Source from the content-addressed store, hash-verified

76}
77
78func doShutdown(reason string) {
79 shutdownOnce.Do(func() {
80 log.Printf("shutting down: %s\n", reason)
81 ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
82 defer cancelFn()
83 go blockcontroller.StopAllBlockControllersForShutdown()
84 shutdownActivityUpdate()
85 sendTelemetryWrapper()
86 // TODO deal with flush in progress
87 clearTempFiles()
88 filestore.WFS.FlushCache(ctx)
89 watcher := wconfig.GetWatcher()
90 if watcher != nil {
91 watcher.Close()
92 }
93 time.Sleep(500 * time.Millisecond)
94 log.Printf("shutdown complete\n")
95 os.Exit(0)
96 })
97}
98
99// watch stdin, kill server if stdin is closed
100func stdinReadWatch() {

Callers 2

stdinReadWatchFunction · 0.85

Calls 7

GetWatcherFunction · 0.92
shutdownActivityUpdateFunction · 0.85
sendTelemetryWrapperFunction · 0.85
clearTempFilesFunction · 0.85
FlushCacheMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected