MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / startCacheCompaction

Method startCacheCompaction

db/channel_cache.go:447–452  ·  view source on GitHub ↗

startCacheCompaction starts a goroutine for cache compaction if it's not already running.

(ctx context.Context)

Source from the content-addressed store, hash-verified

445
446// startCacheCompaction starts a goroutine for cache compaction if it's not already running.
447func (c *channelCacheImpl) startCacheCompaction(ctx context.Context) {
448 compactNotStarted := c.compactRunning.CompareAndSwap(false, true)
449 if compactNotStarted {
450 go c.compactChannelCache(ctx)
451 }
452}
453
454// Compact runs until the number of channels in the cache is lower than compactLowWatermark
455func (c *channelCacheImpl) compactChannelCache(ctx context.Context) {

Callers 1

addChannelCacheMethod · 0.95

Calls 2

compactChannelCacheMethod · 0.95
CompareAndSwapMethod · 0.80

Tested by

no test coverage detected