Move database connections map out to separate package (#21207)

The upcoming event main plugin will use a very similar pattern
as the database plugin map, so it makes sense to refactor this and move
this map out. It also cleans up the database plugin backend so that
it does not have to keep track of the lock.

Co-authored-by: Tom Proctor <tomhjp@users.noreply.github.com>
This commit is contained in:
Christopher Swenson
2023-06-22 10:20:13 -07:00
committed by GitHub
parent 58b6cb1c42
commit cf48236a3c
6 changed files with 179 additions and 65 deletions

View File

@@ -462,7 +462,7 @@ func (b *databaseBackend) connectionWriteHandler() framework.OperationFunc {
b.Logger().Debug("created database object", "name", name, "plugin_name", config.PluginName)
// Close and remove the old connection
oldConn := b.connPut(name, &dbPluginInstance{
oldConn := b.connections.Put(name, &dbPluginInstance{
database: dbw,
name: name,
id: id,