From 397fb731098349e71df824ddbb01a80728122711 Mon Sep 17 00:00:00 2001 From: Artem Poltorzhitskiy Date: Fri, 13 Dec 2024 14:22:44 +0100 Subject: [PATCH] Fix: disable TTL cache (#317) --- cmd/api/init.go | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/cmd/api/init.go b/cmd/api/init.go index 345b2991..daa23e15 100644 --- a/cmd/api/init.go +++ b/cmd/api/init.go @@ -269,12 +269,6 @@ func initDatabase(cfg config.Database, viewsDir string) postgres.Storage { } func initHandlers(ctx context.Context, e *echo.Echo, cfg Config, db postgres.Storage) { - ttlCache, err := cache.NewTTLCache(time.Minute * 30) - if err != nil { - panic(err) - } - ttlCacheMiddleware := cache.Middleware(ttlCache, nil) - if cfg.ApiConfig.Prometheus { e.GET("/metrics", echoprometheus.NewHandler()) } @@ -323,13 +317,13 @@ func initHandlers(ctx context.Context, e *echo.Echo, cfg Config, db postgres.Sto blockGroup.GET("/count", blockHandlers.Count) heightGroup := blockGroup.Group("/:height") { - heightGroup.GET("", blockHandlers.Get, ttlCacheMiddleware) - heightGroup.GET("/events", blockHandlers.GetEvents, ttlCacheMiddleware) - heightGroup.GET("/messages", blockHandlers.GetMessages, ttlCacheMiddleware) - heightGroup.GET("/stats", blockHandlers.GetStats, ttlCacheMiddleware) - heightGroup.GET("/blobs", blockHandlers.Blobs, ttlCacheMiddleware) - heightGroup.GET("/blobs/count", blockHandlers.BlobsCount, ttlCacheMiddleware) - heightGroup.GET("/ods", blockHandlers.BlockODS, ttlCacheMiddleware) + heightGroup.GET("", blockHandlers.Get) + heightGroup.GET("/events", blockHandlers.GetEvents) + heightGroup.GET("/messages", blockHandlers.GetMessages) + heightGroup.GET("/stats", blockHandlers.GetStats) + heightGroup.GET("/blobs", blockHandlers.Blobs) + heightGroup.GET("/blobs/count", blockHandlers.BlobsCount) + heightGroup.GET("/ods", blockHandlers.BlockODS) } } @@ -341,11 +335,11 @@ func initHandlers(ctx context.Context, e *echo.Echo, cfg Config, db postgres.Sto txGroup.GET("/genesis", txHandlers.Genesis) hashGroup := txGroup.Group("/:hash") { - hashGroup.GET("", txHandlers.Get, ttlCacheMiddleware) - hashGroup.GET("/events", txHandlers.GetEvents, ttlCacheMiddleware) - hashGroup.GET("/messages", txHandlers.GetMessages, ttlCacheMiddleware) - hashGroup.GET("/blobs", txHandlers.Blobs, ttlCacheMiddleware) - hashGroup.GET("/blobs/count", txHandlers.BlobsCount, ttlCacheMiddleware) + hashGroup.GET("", txHandlers.Get) + hashGroup.GET("/events", txHandlers.GetEvents) + hashGroup.GET("/messages", txHandlers.GetMessages) + hashGroup.GET("/blobs", txHandlers.Blobs) + hashGroup.GET("/blobs/count", txHandlers.BlobsCount) } }