From 2af64d823ba1cc6f67f2e166235adc3541cbbe52 Mon Sep 17 00:00:00 2001 From: Gabe <7622243+decentralgabe@users.noreply.github.com> Date: Wed, 6 Dec 2023 00:09:26 +0100 Subject: [PATCH] lower mem limit (#67) --- impl/config/config.go | 2 +- impl/config/config.toml | 2 +- impl/pkg/service/pkarr.go | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/impl/config/config.go b/impl/config/config.go index b0eb0bc9..7519bb6a 100644 --- a/impl/config/config.go +++ b/impl/config/config.go @@ -79,7 +79,7 @@ func GetDefaultConfig() Config { PkarrConfig: PKARRServiceConfig{ RepublishCRON: "0 */2 * * *", CacheTTLSeconds: 600, - CacheSizeLimitMB: 2000, + CacheSizeLimitMB: 500, }, } } diff --git a/impl/config/config.toml b/impl/config/config.toml index 1fe520d3..74c563c9 100644 --- a/impl/config/config.toml +++ b/impl/config/config.toml @@ -13,4 +13,4 @@ bootstrap_peers = ["router.magnets.im:6881", "router.bittorrent.com:6881", "dht. [pkarr] republish_cron = "0 */2 * * *" # every 2 hours cache_ttl_seconds = 600 # 10 minutes -cache_size_limit_mb = 2000 # 2GB +cache_size_limit_mb = 500 # 512 MB diff --git a/impl/pkg/service/pkarr.go b/impl/pkg/service/pkarr.go index b3c07cb0..ae6d30ba 100644 --- a/impl/pkg/service/pkarr.go +++ b/impl/pkg/service/pkarr.go @@ -117,6 +117,7 @@ func (s *PkarrService) PublishPkarr(ctx context.Context, id string, request Publ if err != nil { return err } + if err = s.cache.Set(id, recordBytes); err != nil { return err } @@ -186,7 +187,7 @@ func (s *PkarrService) GetPkarr(ctx context.Context, id string) (*GetPkarrRespon logrus.WithError(err).Errorf("failed to set pkarr record[%s] in cache", id) } } - return resp, nil + return resp, err } // prepare the record for return