database: don't prune locks when we renew one

This commit is contained in:
Quentin Machu 2016-01-24 01:20:34 -05:00 committed by Jimmy Zelinskie
parent 2690800331
commit d3d689a26a

View File

@ -32,9 +32,6 @@ func (pgSQL *pgSQL) Lock(name string, owner string, duration time.Duration, rene
defer observeQueryTime("Lock", "all", time.Now()) defer observeQueryTime("Lock", "all", time.Now())
// Prune locks.
pgSQL.pruneLocks()
// Compute expiration. // Compute expiration.
until := time.Now().Add(duration) until := time.Now().Add(duration)
@ -49,6 +46,9 @@ func (pgSQL *pgSQL) Lock(name string, owner string, duration time.Duration, rene
// Updated successfully. // Updated successfully.
return true, until return true, until
} }
} else {
// Prune locks.
pgSQL.pruneLocks()
} }
// Lock. // Lock.