From 1f83b4fc9b9dabda186257b38c265fe7012f90df Mon Sep 17 00:00:00 2001
From: Andrew Thornton <art27@cantab.net>
Date: Tue, 7 Jan 2020 09:08:29 +0000
Subject: [PATCH] Rename QUEUE_NAME REDIS_QUEUE_NAME

---
 .../doc/advanced/config-cheat-sheet.en-us.md  |  2 +-
 modules/queue/queue_redis.go                  | 28 +++++++++----------
 modules/queue/setting.go                      |  2 +-
 modules/setting/queue.go                      | 12 ++++----
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index dc6a1ba346..a92682c9c3 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -247,7 +247,7 @@ relation to port exhaustion.
 - `LENGTH`: **20**: Maximal queue size before channel queues block
 - `BATCH_LENGTH`: **20**: Batch data before passing to the handler
 - `CONN_STR`: **addrs=127.0.0.1:6379 db=0**: Connection string for the redis queue type.
-- `QUEUE_NAME`: **_queue**: The suffix for default redis queue name. Individual queues will default to **`name`**`QUEUE_NAME` but can be overriden in the specific `queue.name` section.
+- `REDIS_QUEUE_NAME`: **_queue**: The suffix for default redis queue name. Individual queues will default to **`name`**`REDIS_QUEUE_NAME` but can be overriden in the specific `queue.name` section.
 - `WRAP_IF_NECESSARY`: **true**: Will wrap queues with a timeoutable queue if the selected queue is not ready to be created - (Only relevant for the level queue.)
 - `MAX_ATTEMPTS`: **10**: Maximum number of attempts to create the wrapped queue
 - `TIMEOUT`: **GRACEFUL_HAMMER_TIME + 30s**: Timeout the creation of the wrapped queue if it takes longer than this to create.
diff --git a/modules/queue/queue_redis.go b/modules/queue/queue_redis.go
index 14e68937a5..a9406864a3 100644
--- a/modules/queue/queue_redis.go
+++ b/modules/queue/queue_redis.go
@@ -44,19 +44,19 @@ type RedisQueue struct {
 
 // RedisQueueConfiguration is the configuration for the redis queue
 type RedisQueueConfiguration struct {
-	Network      string
-	Addresses    string
-	Password     string
-	DBIndex      int
-	BatchLength  int
-	QueueLength  int
-	QueueName    string
-	Workers      int
-	MaxWorkers   int
-	BlockTimeout time.Duration
-	BoostTimeout time.Duration
-	BoostWorkers int
-	Name         string
+	Network        string
+	Addresses      string
+	Password       string
+	DBIndex        int
+	BatchLength    int
+	QueueLength    int
+	RedisQueueName string
+	Workers        int
+	MaxWorkers     int
+	BlockTimeout   time.Duration
+	BoostTimeout   time.Duration
+	BoostWorkers   int
+	Name           string
 }
 
 // NewRedisQueue creates single redis or cluster redis queue
@@ -84,7 +84,7 @@ func NewRedisQueue(handle HandlerFunc, cfg, exemplar interface{}) (Queue, error)
 			boostWorkers:       config.BoostWorkers,
 			maxNumberOfWorkers: config.MaxWorkers,
 		},
-		queueName: config.QueueName,
+		queueName: config.RedisQueueName,
 		exemplar:  exemplar,
 		closed:    make(chan struct{}),
 		workers:   config.Workers,
diff --git a/modules/queue/setting.go b/modules/queue/setting.go
index d5a6b41882..9ae8cf0dd7 100644
--- a/modules/queue/setting.go
+++ b/modules/queue/setting.go
@@ -36,7 +36,7 @@ func CreateQueue(name string, handle HandlerFunc, exemplar interface{}) Queue {
 	opts["Network"] = q.Network
 	opts["Password"] = q.Password
 	opts["DBIndex"] = q.DBIndex
-	opts["QueueName"] = q.QueueName
+	opts["RedisQueueName"] = q.RedisQueueName
 	opts["Workers"] = q.Workers
 	opts["MaxWorkers"] = q.MaxWorkers
 	opts["BlockTimeout"] = q.BlockTimeout
diff --git a/modules/setting/queue.go b/modules/setting/queue.go
index 546802715f..639e6d7c1e 100644
--- a/modules/setting/queue.go
+++ b/modules/setting/queue.go
@@ -24,7 +24,7 @@ type QueueSettings struct {
 	Network          string
 	Addresses        string
 	Password         string
-	QueueName        string
+	RedisQueueName   string
 	DBIndex          int
 	WrapIfNecessary  bool
 	MaxAttempts      int
@@ -45,14 +45,14 @@ func GetQueueSettings(name string) QueueSettings {
 	sec := Cfg.Section("queue." + name)
 	// DataDir is not directly inheritable
 	q.DataDir = path.Join(Queue.DataDir, name)
-	// QueueName is not directly inheritable either
-	q.QueueName = name + Queue.QueueName
+	// RedisQueueName is not directly inheritable either
+	q.RedisQueueName = name + Queue.RedisQueueName
 	for _, key := range sec.Keys() {
 		switch key.Name() {
 		case "DATADIR":
 			q.DataDir = key.MustString(q.DataDir)
-		case "QUEUE_NAME":
-			q.QueueName = key.MustString(q.QueueName)
+		case "REDIS_QUEUE_NAME":
+			q.RedisQueueName = key.MustString(q.RedisQueueName)
 		}
 	}
 	if !path.IsAbs(q.DataDir) {
@@ -98,7 +98,7 @@ func NewQueueService() {
 	Queue.BlockTimeout = sec.Key("BLOCK_TIMEOUT").MustDuration(1 * time.Second)
 	Queue.BoostTimeout = sec.Key("BOOST_TIMEOUT").MustDuration(5 * time.Minute)
 	Queue.BoostWorkers = sec.Key("BOOST_WORKERS").MustInt(5)
-	Queue.QueueName = sec.Key("QUEUE_NAME").MustString("_queue")
+	Queue.RedisQueueName = sec.Key("REDIS_QUEUE_NAME").MustString("_queue")
 
 	// Now handle the old issue_indexer configuration
 	section := Cfg.Section("queue.issue_indexer")