internal: ensure schema manager is closed (#5521)
This releases the connection it holds indefinitely
This commit is contained in:
1 parent
acc40e0d08
commit
5de0c8c102
4 files changed
+5
No files matched your search
@@ -46,11 +46,13 @@ func migrateDatabase(ctx context.Context, ui cli.Ui, dialect, u string, initiali
|
||||
// This is an advisory lock on the DB which is released when the DB session ends.
|
||||
if err := man.ExclusiveLock(ctx); err != nil {
|
||||
ui.Error("Unable to capture a lock on the database.")
|
||||
_ = man.Close(ctx)
|
||||
return noop, 2
|
||||
}
|
||||
unlock := func() {
|
||||
// We don't report anything since this should resolve itself anyways.
|
||||
_ = man.ExclusiveUnlock(ctx)
|
||||
_ = man.Close(ctx)
|
||||
}
|
||||
|
||||
st, err := man.CurrentState(ctx)
|
||||
|
||||
Reference in new issue
Block a user