internal/postgres: drop locking messages when query logging is disabled
Avoids log clutter during tests.
Trust: Jonathan Amsterdam
Run-TryBot: Jonathan Amsterdam
TryBot-Result: kokoro
@@ -443,12 +443,16 @@ func lock(ctx context.Context, tx *database.DB, modulePath string) (err error) {
hasher := fnv.New64()
io.WriteString(hasher, modulePath) // Writing to a hash.Hash never returns an error.
h := int64(hasher.Sum64())
+ if !database.QueryLoggingDisabled {
log.Debugf(ctx, "locking %s (%d) ...", modulePath, h)
+ }
// See https://www.postgresql.org/docs/11/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS.
if _, err := tx.Exec(ctx, `SELECT pg_advisory_xact_lock($1)`, h); err != nil {
return err
}
+ if !database.QueryLoggingDisabled {
log.Debugf(ctx, "locking %s (%d) succeeded", modulePath, h)
+ }
return nil
}
