mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2024-12-22 19:49:25 +00:00
Reuse existing db connection (if any)
This commit is contained in:
parent
70372e58ab
commit
5f5ebd81a9
1 changed files with 4 additions and 0 deletions
|
@ -16,6 +16,10 @@ var defaultDB = &DB{}
|
|||
|
||||
// connect sets the db client of database using configuration
|
||||
func (db *DB) connect(cfg *config.DB) (err error) {
|
||||
if defaultDB.DB != nil {
|
||||
return nil // reuse existing connection if available
|
||||
}
|
||||
|
||||
dbURI := fmt.Sprintf("%s:%s@(%s:%d)/%s",
|
||||
cfg.User,
|
||||
cfg.Password,
|
||||
|
|
Loading…
Reference in a new issue