From a9e801cb225be67a4fa690bacb6ece0af75a4873 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Mon, 5 Oct 2020 13:44:28 +0300 Subject: [PATCH] [#71] Make GC configurable Signed-off-by: Alex Vanin --- cmd/neofs-node/config.go | 11 +++++++++-- cmd/neofs-node/object.go | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index 2ce95ccf..adfc25a0 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -46,6 +46,7 @@ const ( cfgNodeKey = "node.key" cfgBootstrapAddress = "node.address" cfgNodeAttributePrefix = "node.attribute" + cfgMaxObjectSize = "node.maxobjectsize" // todo: get value from chain // config keys for cfgGRPC cfgListenAddress = "grpc.endpoint" @@ -66,10 +67,12 @@ const ( cfgContainerContract = "container.scripthash" cfgContainerFee = "container.fee" - cfgMaxObjectSize = "node.maxobjectsize" // get value from chain - cfgObjectStorage = "storage.object" cfgMetaStorage = "storage.meta" + + cfgGCQueueSize = "gc.queuesize" + cfgGCQueueTick = "gc.duration.sleep" + cfgGCTimeout = "gc.duration.timeout" ) const ( @@ -286,6 +289,10 @@ func defaultConfiguration(v *viper.Viper) { v.SetDefault(cfgProfilerEnable, false) v.SetDefault(cfgProfilerAddr, ":6060") v.SetDefault(cfgProfilerTTL, "30s") + + v.SetDefault(cfgGCQueueSize, 1000) + v.SetDefault(cfgGCQueueTick, "5s") + v.SetDefault(cfgGCTimeout, "5s") } func (c *cfg) LocalAddress() *network.Address { diff --git a/cmd/neofs-node/object.go b/cmd/neofs-node/object.go index 69a027df..b307dad1 100644 --- a/cmd/neofs-node/object.go +++ b/cmd/neofs-node/object.go @@ -192,6 +192,9 @@ func initObjectService(c *cfg) { objGC := gc.New( gc.WithLogger(c.log), gc.WithRemover(ls), + gc.WithQueueCapacity(c.viper.GetUint32(cfgGCQueueSize)), + gc.WithSleepInterval(c.viper.GetDuration(cfgGCQueueTick)), + gc.WithWorkingInterval(c.viper.GetDuration(cfgGCTimeout)), ) c.workers = append(c.workers, objGC)