MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / startMemoryTicker

Method startMemoryTicker

imgproxy.go:282–298  ·  view source on GitHub ↗

startMemoryTicker starts a ticker that periodically frees memory and optionally logs memory stats

(ctx context.Context)

Source from the content-addressed store, hash-verified

280
281// startMemoryTicker starts a ticker that periodically frees memory and optionally logs memory stats
282func (i *Imgproxy) startMemoryTicker(ctx context.Context) {
283 ticker := time.NewTicker(i.config.Server.FreeMemoryInterval)
284 defer ticker.Stop()
285
286 for {
287 select {
288 case <-ctx.Done():
289 return
290 case <-ticker.C:
291 memory.Free()
292
293 if i.config.Server.LogMemStats {
294 memory.LogStats()
295 }
296 }
297 }
298}

Callers 1

StartServerMethod · 0.95

Calls 3

FreeFunction · 0.92
LogStatsFunction · 0.92
StopMethod · 0.65

Tested by

no test coverage detected