| 149 | } |
| 150 | |
| 151 | func (sc *ServerContext) CloseCpuPprofFile(ctx context.Context) (filename string) { |
| 152 | sc.cpuPprofFileMutex.Lock() |
| 153 | if sc.cpuPprofFile != nil { |
| 154 | filename = sc.cpuPprofFile.Name() |
| 155 | } |
| 156 | if err := sc.cpuPprofFile.Close(); err != nil { |
| 157 | base.WarnfCtx(ctx, "Error closing CPU profile file: %v", err) |
| 158 | } |
| 159 | sc.cpuPprofFile = nil |
| 160 | sc.cpuPprofFileMutex.Unlock() |
| 161 | return filename |
| 162 | } |
| 163 | |
| 164 | func NewServerContext(ctx context.Context, config *StartupConfig, persistentConfig bool) *ServerContext { |
| 165 | |