Skip to content
Snippets Groups Projects
Unverified Commit 79fd9f89 authored by Bruno Michel's avatar Bruno Michel Committed by GitHub
Browse files

Fix a panic on destroy instance (#2863)

A race condition may happen when destroying an instance that leads to a
panic.
parent 50e5f5cb
Branches
Tags
No related merge requests found
...@@ -78,8 +78,12 @@ func destroyWithoutHooks(domain string) error { ...@@ -78,8 +78,12 @@ func destroyWithoutHooks(domain string) error {
// this document when we have concurrent updates for indexes/views // this document when we have concurrent updates for indexes/views
// version and deleting flag. // version and deleting flag.
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)
inst, _ = instance.GetFromCouch(domain) inst, errg := instance.GetFromCouch(domain)
err = couchdb.DeleteDoc(couchdb.GlobalDB, inst) if couchdb.IsNotFoundError(errg) {
err = nil
} else if inst != nil {
err = couchdb.DeleteDoc(couchdb.GlobalDB, inst)
}
} }
return err return err
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment