From 3ff1391a9dfaeee4102654a6a871ef843e13b639 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Mon, 1 May 2023 11:36:46 +0100 Subject: [performance] replace domain block cache with an in-memory radix trie (#1714) * replace domain block cache with an in-memory radix tree Signed-off-by: kim * fix domain block cache init Signed-off-by: kim --------- Signed-off-by: kim --- internal/cache/gts.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'internal/cache/gts.go') diff --git a/internal/cache/gts.go b/internal/cache/gts.go index a96bc3608..1032a5611 100644 --- a/internal/cache/gts.go +++ b/internal/cache/gts.go @@ -72,12 +72,6 @@ func (c *GTSCaches) Init() { func (c *GTSCaches) Start() { tryStart(c.account, config.GetCacheGTSAccountSweepFreq()) tryStart(c.block, config.GetCacheGTSBlockSweepFreq()) - tryUntil("starting domain block cache", 5, func() bool { - if sweep := config.GetCacheGTSDomainBlockSweepFreq(); sweep > 0 { - return c.domainBlock.Start(sweep) - } - return true - }) tryStart(c.emoji, config.GetCacheGTSEmojiSweepFreq()) tryStart(c.emojiCategory, config.GetCacheGTSEmojiCategorySweepFreq()) tryStart(c.follow, config.GetCacheGTSFollowSweepFreq()) @@ -102,7 +96,6 @@ func (c *GTSCaches) Start() { func (c *GTSCaches) Stop() { tryStop(c.account, config.GetCacheGTSAccountSweepFreq()) tryStop(c.block, config.GetCacheGTSBlockSweepFreq()) - tryUntil("stopping domain block cache", 5, c.domainBlock.Stop) tryStop(c.emoji, config.GetCacheGTSEmojiSweepFreq()) tryStop(c.emojiCategory, config.GetCacheGTSEmojiCategorySweepFreq()) tryStop(c.follow, config.GetCacheGTSFollowSweepFreq()) @@ -233,10 +226,7 @@ func (c *GTSCaches) initBlock() { } func (c *GTSCaches) initDomainBlock() { - c.domainBlock = domain.New( - config.GetCacheGTSDomainBlockMaxSize(), - config.GetCacheGTSDomainBlockTTL(), - ) + c.domainBlock = new(domain.BlockCache) } func (c *GTSCaches) initEmoji() { -- cgit v1.2.3