Skip to content

Commit e83a073

Browse files
committed
Fix the endless loop in transfers test :)
1 parent 7a43e43 commit e83a073

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/pg_xtm/tests/transfers.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func transfer(id int, cCommits chan int, cAborts chan int, wg *sync.WaitGroup) {
113113
var xid int32
114114
var nAborts = 0
115115
var nCommits = 0
116+
var myCommits = 0
116117

117118
conn1, err := pgx.Connect(cfg1)
118119
checkErr(err)
@@ -123,7 +124,7 @@ func transfer(id int, cCommits chan int, cAborts chan int, wg *sync.WaitGroup) {
123124
defer conn2.Close()
124125

125126
start := time.Now()
126-
for nCommits < N_ITERATIONS {
127+
for myCommits < N_ITERATIONS {
127128
amount := 2*rand.Intn(2000) - 1
128129
//amount := 1
129130
account1 := rand.Intn(N_ACCOUNTS)
@@ -145,6 +146,7 @@ func transfer(id int, cCommits chan int, cAborts chan int, wg *sync.WaitGroup) {
145146
} else {
146147
commit(conn1, conn2)
147148
nCommits += 1
149+
myCommits += 1
148150
}
149151

150152
if time.Since(start).Seconds() > 1 {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy