@@ -7,8 +7,6 @@ package setting
7
7
import (
8
8
"fmt"
9
9
"path/filepath"
10
- "strconv"
11
- "strings"
12
10
"time"
13
11
14
12
"code.gitea.io/gitea/modules/log"
@@ -22,12 +20,8 @@ type QueueSettings struct {
22
20
BatchLength int
23
21
ConnectionString string
24
22
Type string
25
- Network string
26
- Addresses string
27
- Password string
28
23
QueueName string
29
24
SetName string
30
- DBIndex int
31
25
WrapIfNecessary bool
32
26
MaxAttempts int
33
27
Timeout time.Duration
@@ -83,7 +77,6 @@ func GetQueueSettings(name string) QueueSettings {
83
77
q .BoostTimeout = sec .Key ("BOOST_TIMEOUT" ).MustDuration (Queue .BoostTimeout )
84
78
q .BoostWorkers = sec .Key ("BOOST_WORKERS" ).MustInt (Queue .BoostWorkers )
85
79
86
- q .Network , q .Addresses , q .Password , q .DBIndex , _ = ParseQueueConnStr (q .ConnectionString )
87
80
return q
88
81
}
89
82
@@ -100,7 +93,6 @@ func NewQueueService() {
100
93
Queue .ConnectionString = sec .Key ("CONN_STR" ).MustString ("" )
101
94
defaultType := sec .Key ("TYPE" ).String ()
102
95
Queue .Type = sec .Key ("TYPE" ).MustString ("persistable-channel" )
103
- Queue .Network , Queue .Addresses , Queue .Password , Queue .DBIndex , _ = ParseQueueConnStr (Queue .ConnectionString )
104
96
Queue .WrapIfNecessary = sec .Key ("WRAP_IF_NECESSARY" ).MustBool (true )
105
97
Queue .MaxAttempts = sec .Key ("MAX_ATTEMPTS" ).MustInt (10 )
106
98
Queue .Timeout = sec .Key ("TIMEOUT" ).MustDuration (GracefulHammerTime + 30 * time .Second )
@@ -167,28 +159,3 @@ func NewQueueService() {
167
159
_ , _ = section .NewKey ("LENGTH" , fmt .Sprintf ("%d" , Repository .PullRequestQueueLength ))
168
160
}
169
161
}
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