Skip to content

Commit 453d396

Browse files
prometherionaiharos
authored andcommitted
BUG/MEDIUM: transactions: decreasing counter also for mismatching version
1 parent 5fa83ea commit 453d396

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

handlers/transaction.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,16 @@ func (r RateLimitedStartTransactionHandlerImpl) Handle(params transactions.Start
160160

161161
func (r RateLimitedCommitTransactionHandlerImpl) Handle(params transactions.CommitTransactionParams, principal interface{}) middleware.Responder {
162162
res := r.Handler.Handle(params, principal)
163-
switch res.(type) {
163+
switch t := res.(type) {
164164
case *transactions.CommitTransactionOK:
165165
r.TransactionCounter.Decrease()
166166
case *transactions.CommitTransactionAccepted:
167167
r.TransactionCounter.Decrease()
168+
case *transactions.CommitTransactionDefault:
169+
// Decreasing the counter in case of failed transactions
170+
if *t.Payload.Code == 409 {
171+
r.TransactionCounter.Decrease()
172+
}
168173
}
169174
return res
170175
}

0 commit comments

Comments
 (0)