Merge pull request #287 from ctuong/pg-lock-comment

Update postgres driver Lock comment to reflect actual behavior
This commit is contained in:
Dale Hui 2019-09-25 00:57:45 -07:00 committed by GitHub
commit fc060940b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

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