From 32c0941343050f5ef913efd6d2faeca7fe57136b Mon Sep 17 00:00:00 2001 From: Rohan Chavan Date: Tue, 8 Oct 2024 17:43:51 +0530 Subject: [PATCH] #999 Get adhocReqChan buffer from config (#1005) --- config/config.go | 3 +++ dice.toml | 1 + internal/worker/worker.go | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index 8c85f5fea..a2376e906 100644 --- a/config/config.go +++ b/config/config.go @@ -72,6 +72,7 @@ type Config struct { EnableMultiThreading bool `mapstructure:"enablemultithreading"` StoreMapInitSize int `mapstructure:"storemapinitsize"` WatchChanBufSize int `mapstructure:"watchchanbufsize"` + AdhocReqChanBufSize int `mapstructure:"adhocreqchanbufsize"` } `mapstructure:"server"` Auth struct { UserName string `mapstructure:"username"` @@ -106,6 +107,7 @@ var baseConfig = Config{ EnableMultiThreading bool `mapstructure:"enablemultithreading"` StoreMapInitSize int `mapstructure:"storemapinitsize"` WatchChanBufSize int `mapstructure:"watchchanbufsize"` + AdhocReqChanBufSize int `mapstructure:"adhocreqchanbufsize"` }{ Addr: DefaultHost, Port: DefaultPort, @@ -127,6 +129,7 @@ var baseConfig = Config{ EnableMultiThreading: false, StoreMapInitSize: 1024000, WatchChanBufSize: 20000, + AdhocReqChanBufSize: 20, // assuming we wouldn't have more than 20 adhoc requests being sent at a time. }, Auth: struct { UserName string `mapstructure:"username"` diff --git a/dice.toml b/dice.toml index 3bd1f2c66..3d1658cb0 100644 --- a/dice.toml +++ b/dice.toml @@ -21,6 +21,7 @@ PrettyPrintLogs = false EnableMultiThreading = false StoreMapInitSize = 10240 WatchChanBufSize = 20000 +AdhocReqChanBufSize = 20 [Auth] UserName = 'dice' diff --git a/internal/worker/worker.go b/internal/worker/worker.go index 3d3e04be1..3aebb91d7 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -55,7 +55,7 @@ func NewWorker(wid string, respChan chan *ops.StoreResponse, respChan: respChan, logger: logger, Session: auth.NewSession(), - adhocReqChan: make(chan *cmd.DiceDBCmd, 20), // assuming we wouldn't have more than 20 adhoc requests being sent at a time. + adhocReqChan: make(chan *cmd.DiceDBCmd, config.DiceConfig.Server.AdhocReqChanBufSize), } }