Skip to content

Commit f2b4b0f

Browse files
authored
Remove ParseQueueConnStr as it is unused (#16878)
Remove ParseQueueConnStr as `modules/nosql` has taken over all of its functions. Signed-off-by: Andrew Thornton <[email protected]>
1 parent 6d97bef commit f2b4b0f

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

modules/setting/queue.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ package setting
77
import (
88
"fmt"
99
"path/filepath"
10-
"strconv"
11-
"strings"
1210
"time"
1311

1412
"code.gitea.io/gitea/modules/log"
@@ -22,12 +20,8 @@ type QueueSettings struct {
2220
BatchLength int
2321
ConnectionString string
2422
Type string
25-
Network string
26-
Addresses string
27-
Password string
2823
QueueName string
2924
SetName string
30-
DBIndex int
3125
WrapIfNecessary bool
3226
MaxAttempts int
3327
Timeout time.Duration
@@ -83,7 +77,6 @@ func GetQueueSettings(name string) QueueSettings {
8377
q.BoostTimeout = sec.Key("BOOST_TIMEOUT").MustDuration(Queue.BoostTimeout)
8478
q.BoostWorkers = sec.Key("BOOST_WORKERS").MustInt(Queue.BoostWorkers)
8579

86-
q.Network, q.Addresses, q.Password, q.DBIndex, _ = ParseQueueConnStr(q.ConnectionString)
8780
return q
8881
}
8982

@@ -100,7 +93,6 @@ func NewQueueService() {
10093
Queue.ConnectionString = sec.Key("CONN_STR").MustString("")
10194
defaultType := sec.Key("TYPE").String()
10295
Queue.Type = sec.Key("TYPE").MustString("persistable-channel")
103-
Queue.Network, Queue.Addresses, Queue.Password, Queue.DBIndex, _ = ParseQueueConnStr(Queue.ConnectionString)
10496
Queue.WrapIfNecessary = sec.Key("WRAP_IF_NECESSARY").MustBool(true)
10597
Queue.MaxAttempts = sec.Key("MAX_ATTEMPTS").MustInt(10)
10698
Queue.Timeout = sec.Key("TIMEOUT").MustDuration(GracefulHammerTime + 30*time.Second)
@@ -167,28 +159,3 @@ func NewQueueService() {
167159
_, _ = section.NewKey("LENGTH", fmt.Sprintf("%d", Repository.PullRequestQueueLength))
168160
}
169161
}
170-
171-
// ParseQueueConnStr parses a queue connection string
172-
func ParseQueueConnStr(connStr string) (network, addrs, password string, dbIdx int, err error) {
173-
fields := strings.Fields(connStr)
174-
for _, f := range fields {
175-
items := strings.SplitN(f, "=", 2)
176-
if len(items) < 2 {
177-
continue
178-
}
179-
switch strings.ToLower(items[0]) {
180-
case "network":
181-
network = items[1]
182-
case "addrs":
183-
addrs = items[1]
184-
case "password":
185-
password = items[1]
186-
case "db":
187-
dbIdx, err = strconv.Atoi(items[1])
188-
if err != nil {
189-
return
190-
}
191-
}
192-
}
193-
return
194-
}

0 commit comments

Comments
 (0)