Skip to content

Commit 31e2c8a

Browse files
chertsMikhail Grigorev
andauthored
Fixed incorrect conversion between integer types (#172)
Co-authored-by: Mikhail Grigorev <grigorev_mm@magnit.ru>
1 parent ed50895 commit 31e2c8a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

internal/collector/collector.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
package collector
33

44
import (
5+
"maps"
56
"strconv"
67
"sync"
78

8-
"github.com/jackc/pgx/v4"
9-
109
"github.com/cherts/pgscv/internal/filter"
1110
"github.com/cherts/pgscv/internal/log"
1211
"github.com/cherts/pgscv/internal/model"
12+
"github.com/jackc/pgx/v4"
1313
"github.com/prometheus/client_golang/prometheus"
14-
"maps"
1514
)
1615

1716
// Factories defines collector functions which used for collecting metrics.

internal/collector/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ func newPostgresServiceConfig(connStr string, connTimeout int) (postgresServiceC
9494
var setting string
9595

9696
// Get role connection limit.
97-
err = conn.Conn().QueryRow(context.Background(), "SELECT rolconnlimit FROM pg_roles WHERE rolname = user").Scan(&setting)
97+
err = conn.Conn().QueryRow(context.Background(), "SELECT rolconnlimit FROM pg_roles WHERE rolname = USER").Scan(&setting)
9898
if err != nil {
9999
return config, fmt.Errorf("failed to get rolconnlimit setting from pg_roles, %s, please check user grants", err)
100100
}
101-
rolConnLimit, err := strconv.ParseInt(setting, 10, 64)
101+
rolConnLimit, err := strconv.ParseInt(setting, 10, 32)
102102
if err != nil {
103103
return config, err
104104
}

0 commit comments

Comments
 (0)