Skip to content

Commit

Permalink
Fix: disable TTL cache (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored Dec 13, 2024
1 parent 44ddfc8 commit 397fb73
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions cmd/api/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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)
}
}

Expand Down

0 comments on commit 397fb73

Please sign in to comment.