Add ability to customize some timeouts in MongoDB database plugin (#11600)

This commit is contained in:
Michael Golowka
2021-05-17 11:40:35 -06:00
committed by GitHub
parent a71eebea01
commit 8fdd3f450e
5 changed files with 127 additions and 65 deletions

View File

@@ -78,6 +78,14 @@ func (b *databaseBackend) pathRotateRootCredentialsUpdate() framework.OperationF
return nil, err
}
// Take out the backend lock since we are swapping out the connection
b.Lock()
defer b.Unlock()
// Take the write lock on the instance
dbi.Lock()
defer dbi.Unlock()
defer func() {
// Close the plugin
dbi.closed = true
@@ -88,14 +96,6 @@ func (b *databaseBackend) pathRotateRootCredentialsUpdate() framework.OperationF
delete(b.connections, name)
}()
// Take out the backend lock since we are swapping out the connection
b.Lock()
defer b.Unlock()
// Take the write lock on the instance
dbi.Lock()
defer dbi.Unlock()
// Generate new credentials
oldPassword := config.ConnectionDetails["password"].(string)
newPassword, err := dbi.database.GeneratePassword(ctx, b.System(), config.PasswordPolicy)