Skip to content

Commit af27c2b

Browse files
committed
add dynamic queue update interval to server config
Signed-off-by: Artem Torubarov <[email protected]>
1 parent 34d22b5 commit af27c2b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

server.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ type Config struct {
185185
// StrictPriority: true,
186186
DynamicQueues bool
187187

188+
// DynamicQueueUpdateInterval specifies the interval between updating list of dynamic queue names.
189+
// Parameter corresponds with the latency of the server to pick up the first task from a newly created dynamic queue.
190+
//
191+
// If unset or zero, default interval of 5 seconds is used.
192+
DynamicQueueUpdateInterval time.Duration
193+
188194
// ErrorHandler handles errors returned by the task handler.
189195
//
190196
// HandleError is invoked only if the task handler returns a non-nil error.
@@ -535,10 +541,14 @@ func NewServerFromRedisClient(c redis.UniversalClient, cfg Config) *Server {
535541
srvState := &serverState{value: srvStateNew}
536542
cancels := base.NewCancelations()
537543

544+
dynamicQueueUpdateInterval := cfg.DynamicQueueUpdateInterval
545+
if dynamicQueueUpdateInterval == 0 {
546+
dynamicQueueUpdateInterval = defaultDynamicQueueUpdateInterval
547+
}
538548
queueManager := newQueueManager(queueManagerParams{
539549
logger: logger,
540550
broker: rdb,
541-
interval: defaultDynamicQueueUpdateInterval,
551+
interval: dynamicQueueUpdateInterval,
542552
queues: queues,
543553
strictPriority: cfg.StrictPriority,
544554
dynamicQueues: cfg.DynamicQueues,

0 commit comments

Comments
 (0)