From 076ff959ee27d2e2b927183c9281e8d4ed6644cd Mon Sep 17 00:00:00 2001 From: golangisfun123 Date: Wed, 27 Nov 2024 10:26:42 -0600 Subject: [PATCH] [goreleaser] --- contrib/screener-api/chainalysis/chainalysisapi.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/screener-api/chainalysis/chainalysisapi.go b/contrib/screener-api/chainalysis/chainalysisapi.go index 6b02ddf13d..21584c8f98 100644 --- a/contrib/screener-api/chainalysis/chainalysisapi.go +++ b/contrib/screener-api/chainalysis/chainalysisapi.go @@ -41,6 +41,7 @@ const ( maxCacheSizeGB = 3 bytesInGB = 1024 * 1024 * 1024 chainalysisRequestTimeout = 30 * time.Second + defaultTTL = 24 * time.Hour ) // NewClient creates a new Chainalysis API client. @@ -53,7 +54,10 @@ func NewClient(metricHandler metrics.Handler, riskLevels []string, apiKey, url s // max cache size 3gb // TODO: make this configurable. - registrationCache := gocache.NewCache().WithEvictionPolicy(gocache.LeastRecentlyUsed).WithMaxMemoryUsage(maxCacheSizeGB * bytesInGB) + registrationCache := gocache.NewCache(). + WithEvictionPolicy(gocache.LeastRecentlyUsed). + WithMaxMemoryUsage(maxCacheSizeGB * bytesInGB). + WithDefaultTTL(defaultTTL) otelresty.TraceClient(client, otelresty.WithTracerProvider(metricHandler.GetTracerProvider())) @@ -132,6 +136,8 @@ func (c *clientImpl) checkBlacklist(ctx context.Context, address string) (bool, return true, nil } + c.registrationCache.Delete(address) + return false, nil }