@@ -126,6 +126,8 @@ type Configuration struct {
126126
127127 // ZMQEndpoint is the ZMQ address to publish events, the default value is tcp://localhost:5557
128128 ZMQEndpoint string `yaml:"zmq-endpoint"`
129+ // ZMQRetriesTimes defines the maximum number of retries when ZMQ connection fails
130+ ZMQRetriesTimes uint `yaml:"zmq-retries-times"`
129131 // EventBatchSize is the maximum number of kv-cache events to be sent together, defaults to 16
130132 EventBatchSize int `yaml:"event-batch-size"`
131133
@@ -354,6 +356,9 @@ func (c *Configuration) validate() error {
354356 if c .EventBatchSize < 1 {
355357 return errors .New ("event batch size cannot less than 1" )
356358 }
359+ if c .ZMQRetriesTimes > 10 {
360+ return errors .New ("zmq retries times cannot be more than 10" )
361+ }
357362
358363 if c .FakeMetrics != nil {
359364 if c .FakeMetrics .RunningRequests < 0 || c .FakeMetrics .WaitingRequests < 0 {
@@ -415,6 +420,7 @@ func ParseCommandParamsAndLoadConfig() (*Configuration, error) {
415420 f .StringVar (& config .TokenizersCacheDir , "tokenizers-cache-dir" , config .TokenizersCacheDir , "Directory for caching tokenizers" )
416421 f .StringVar (& config .HashSeed , "hash-seed" , config .HashSeed , "Seed for hash generation (if not set, is read from PYTHONHASHSEED environment variable)" )
417422 f .StringVar (& config .ZMQEndpoint , "zmq-endpoint" , config .ZMQEndpoint , "ZMQ address to publish events" )
423+ f .UintVar (& config .ZMQRetriesTimes , "zmq-retries-times" , config .ZMQRetriesTimes , "Number of times to retry ZMQ requests" )
418424 f .IntVar (& config .EventBatchSize , "event-batch-size" , config .EventBatchSize , "Maximum number of kv-cache events to be sent together" )
419425
420426 // These values were manually parsed above in getParamValueFromArgs, we leave this in order to get these flags in --help
0 commit comments