Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc06094

Browse files
authored
Merge pull request golang-migrate#287 from ctuong/pg-lock-comment
Update postgres driver Lock comment to reflect actual behavior
2 parents 002e0ac + 9ef241d commit fc06094

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

database/postgres/postgres.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ func (p *Postgres) Lock() error {
150150
return err
151151
}
152152

153-
// This will either obtain the lock immediately and return true,
154-
// or return false if the lock cannot be acquired immediately.
153+
// This will wait indefinitely until the lock can be acquired.
155154
query := `SELECT pg_advisory_lock($1)`
156155
if _, err := p.conn.ExecContext(context.Background(), query, aid); err != nil {
157156
return &database.Error{OrigErr: err, Err: "try lock failed", Query: []byte(query)}

0 commit comments

Comments
 (0)