Skip to content

Commit 706def3

Browse files
committed
BUG/MEDIUM: version: fix config version header adapter
1 parent 402e88e commit 706def3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

adapters/adapters.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,14 @@ func ConfigVersionMiddleware(client clientnative.HAProxyClient) Adapter {
134134
if err != nil {
135135
http.Error(w, err.Error(), http.StatusNotImplemented)
136136
}
137-
tr, _ := configuration.GetTransaction(tID)
138137
var v int64
139-
if tr != nil && tr.Status == models.TransactionStatusInProgress {
140-
v, err = configuration.GetConfigurationVersion(tr.ID)
141-
} else {
138+
if tID == "" {
142139
v, err = configuration.GetConfigurationVersion("")
140+
} else {
141+
tr, _ := configuration.GetTransaction(tID)
142+
if tr != nil && tr.Status == models.TransactionStatusInProgress {
143+
v, err = configuration.GetConfigurationVersion(tr.ID)
144+
}
143145
}
144146
if err == nil {
145147
configVersion = strconv.FormatInt(v, 10)

0 commit comments

Comments
 (0)