Skip to content

Commit

Permalink
Change id type from uint32 to int64 in LockPostgreSQL (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilpoona authored Aug 28, 2024
1 parent bd568ae commit 564e983
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions limiters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ func (s *LimitersTestSuite) lockers(generateKeys bool) map[string]l.DistLocker {
return lockers
}

func hash(s string) uint32 {
func hash(s string) int64 {
h := fnv.New32a()
_, err := h.Write([]byte(s))
if err != nil {
panic(err)
}
return h.Sum32()
return int64(h.Sum32())
}

// distLockers returns distributed lockers only.
Expand Down
4 changes: 2 additions & 2 deletions locks.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@ func (l *LockMemcached) Unlock(ctx context.Context) error {
// LockPostgreSQL is an implementation of the DistLocker interface using PostgreSQL's advisory lock.
type LockPostgreSQL struct {
db *sql.DB
id uint32
id int64
tx *sql.Tx
}

// NewLockPostgreSQL creates a new LockPostgreSQL.
func NewLockPostgreSQL(db *sql.DB, id uint32) *LockPostgreSQL {
func NewLockPostgreSQL(db *sql.DB, id int64) *LockPostgreSQL {
return &LockPostgreSQL{db, id, nil}
}

Expand Down

0 comments on commit 564e983

Please sign in to comment.