From c93cc8270ffe11945a00171de09a4664d85b4c33 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Mon, 4 Nov 2024 08:34:05 +0300 Subject: [PATCH 1/2] fix: remove required redis configs --- cmd/service/main.go | 9 ++++++--- dev/docker-compose.yaml | 13 ------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/cmd/service/main.go b/cmd/service/main.go index df4248f..4824be0 100644 --- a/cmd/service/main.go +++ b/cmd/service/main.go @@ -79,15 +79,18 @@ func main() { os.Exit(1) } - cache, err := cache.New(cache.CacheOpts{ + cacheOpts := cache.CacheOpts{ Chain: chain, Registries: ko.Strings("bootstrap.ge_registries"), Watchlist: ko.Strings("bootstrap.watchlist"), Blacklist: ko.Strings("bootstrap.blacklist"), CacheType: ko.MustString("core.cache_type"), - RedisDSN: ko.MustString("redis.dsn"), Logg: lo, - }) + } + if ko.MustString("core.cache_type") == "redis" { + cacheOpts.RedisDSN = ko.MustString("redis.dsn") + } + cache, err := cache.New(cacheOpts) if err != nil { lo.Error("could not initialize cache", "error", err) os.Exit(1) diff --git a/dev/docker-compose.yaml b/dev/docker-compose.yaml index 29054e9..b5668c6 100644 --- a/dev/docker-compose.yaml +++ b/dev/docker-compose.yaml @@ -1,17 +1,4 @@ services: - redis: - image: redis:7-alpine - restart: unless-stopped - command: redis-server --save 60 1 --loglevel warning - volumes: - - tracker-redis:/data - ports: - - "127.0.0.1:6379:6379" - healthcheck: - test: ["CMD-SHELL", "redis-cli ping | grep PONG"] - interval: 10s - timeout: 5s - retries: 5 nats: image: nats:2 restart: unless-stopped From 078ad3614db224fc98311dd91a535479b3101315 Mon Sep 17 00:00:00 2001 From: Mohammed Sohail Date: Tue, 12 Nov 2024 09:02:37 +0300 Subject: [PATCH 2/2] fix: remove unecessary dependency * profiler --- cmd/service/main.go | 15 --------------- go.mod | 1 - go.sum | 2 -- 3 files changed, 18 deletions(-) diff --git a/cmd/service/main.go b/cmd/service/main.go index 4824be0..c98e77d 100644 --- a/cmd/service/main.go +++ b/cmd/service/main.go @@ -25,7 +25,6 @@ import ( "github.com/grassrootseconomics/eth-tracker/internal/syncer" "github.com/grassrootseconomics/eth-tracker/internal/util" "github.com/knadh/koanf/v2" - "github.com/knadh/profiler" ) const defaultGracefulShutdownPeriod = time.Second * 30 @@ -50,14 +49,6 @@ func init() { } func main() { - // PROFILE - p := profiler.New(profiler.Conf{ - MemProfileRate: 1, - NoShutdownHook: true, - }, profiler.Cpu, profiler.Mem) - p.Start() - // PROFILE - var wg sync.WaitGroup ctx, stop := notifyShutdown() @@ -201,12 +192,6 @@ func main() { lo.Info("graceful shutdown routine complete") }() - // PROFILE - runtime.GC() - p.Stop() - time.Sleep(time.Second * 10) - // PROFILE - go func() { wg.Wait() stop() diff --git a/go.mod b/go.mod index 3341ac3..b5a37f2 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,6 @@ require ( github.com/knadh/koanf/providers/env v1.0.0 github.com/knadh/koanf/providers/file v1.1.2 github.com/knadh/koanf/v2 v2.1.1 - github.com/knadh/profiler v0.2.0 github.com/lmittmann/w3 v0.17.1 github.com/nats-io/nats.go v1.36.0 github.com/puzpuzpuz/xsync/v3 v3.4.0 diff --git a/go.sum b/go.sum index fe4f418..2230322 100644 --- a/go.sum +++ b/go.sum @@ -118,8 +118,6 @@ github.com/knadh/koanf/providers/file v1.1.2 h1:aCC36YGOgV5lTtAFz2qkgtWdeQsgfxUk github.com/knadh/koanf/providers/file v1.1.2/go.mod h1:/faSBcv2mxPVjFrXck95qeoyoZ5myJ6uxN8OOVNJJCI= github.com/knadh/koanf/v2 v2.1.1 h1:/R8eXqasSTsmDCsAyYj+81Wteg8AqrV9CP6gvsTsOmM= github.com/knadh/koanf/v2 v2.1.1/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es= -github.com/knadh/profiler v0.2.0 h1:jaY0xlQs8iaWxKdvGHOftaZnX7d8l7yrCGQPSecwnng= -github.com/knadh/profiler v0.2.0/go.mod h1:LqNkAu++MfFkbEDA63AmRaIf6UkGrLXyZ5VQQdekZiI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=