Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
winebarrel committed Oct 2, 2024
1 parent 2cbacc2 commit 6ab6e08
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
linters:
enable:
- gofmt
- gosimple
- misspell
run:
timeout: 5m
issues:
exclude-rules:
- path: _test\.go
linters:
- errcheck
2 changes: 1 addition & 1 deletion que_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func openTestClientMaxConns(t testing.TB, maxConnections int) *Client {
t.Fatal(err)
}
db := sql.OpenDB(connector)
// using stdlib, it's difficult to open max conn from the begining
// using stdlib, it's difficult to open max conn from the beginning
// if we want to open connections till its limit, need to use go routine to
// concurrently open connections
db.SetMaxOpenConns(maxConnections)
Expand Down
11 changes: 8 additions & 3 deletions work_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,17 @@ func TestLockJobAdvisoryRace(t *testing.T) {
}
}()

conn, err := stdlib.AcquireConn(c.pool)
var ourBackendID int32
conn, err := c.pool.Conn(ctx)
if err != nil {
panic(err)
}
ourBackendID := getBackendID(conn)
stdlib.ReleaseConn(c.pool, conn) //nolint:errcheck
conn.Raw(func(driverConn any) error {
pgxConn := driverConn.(*stdlib.Conn).Conn()
ourBackendID = getBackendID(pgxConn)
return nil
})
conn.Close()

// synchronization point
lockJobBackendIDChan <- ourBackendID
Expand Down

0 comments on commit 6ab6e08

Please sign in to comment.