MCPcopy Index your code
hub / github.com/bytebase/bytebase / Run

Method Run

backend/runner/monitor/monitor.go:39–53  ·  view source on GitHub ↗
(ctx context.Context, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

37}
38
39func (mm *MemoryMonitor) Run(ctx context.Context, wg *sync.WaitGroup) {
40 ticker := time.NewTicker(monitorInterval)
41 defer ticker.Stop()
42 defer wg.Done()
43 slog.Debug(fmt.Sprintf("memory monitor: started and will run every %v", monitorInterval))
44 for {
45 select {
46 case <-ctx.Done():
47 return
48 case <-ticker.C:
49 threshold := mm.profile.RuntimeMemoryProfileThreshold.Load()
50 mm.checkMemory(threshold)
51 }
52 }
53}
54
55func (mm *MemoryMonitor) checkMemory(memoryThreshold uint64) {
56 // memoryThreshold == 0 means no need to monitor

Callers 1

RunMethod · 0.95

Calls 4

checkMemoryMethod · 0.95
StopMethod · 0.80
DebugMethod · 0.80
LoadMethod · 0.80

Tested by

no test coverage detected