startCacheCompaction starts a goroutine for cache compaction if it's not already running.
(ctx context.Context)
| 445 | |
| 446 | // startCacheCompaction starts a goroutine for cache compaction if it's not already running. |
| 447 | func (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 |
| 455 | func (c *channelCacheImpl) compactChannelCache(ctx context.Context) { |
no test coverage detected