Compare commits

...

3 Commits

Author SHA1 Message Date
lash
9b71244391 Merge branch 'lash/thread-gdbm' into lash/ssh-2 2024-09-22 15:43:18 +01:00
lash
7d3ff690f0
Remove useless 'registered' member in thread gdbm 2024-09-22 03:10:58 +01:00
lash
a455cfb854
Return if duplicate connect 2024-09-22 03:09:53 +01:00

View File

@ -14,7 +14,6 @@ var (
type ThreadGdbmDb struct { type ThreadGdbmDb struct {
db db.Db db db.Db
registered bool
connStr string connStr string
} }
@ -30,6 +29,7 @@ func(tdb *ThreadGdbmDb) Connect(ctx context.Context, connStr string) error {
_, ok = dbC[connStr] _, ok = dbC[connStr]
if ok { if ok {
logg.WarnCtxf(ctx, "already registered thread gdbm, skipping", "connStr", connStr) logg.WarnCtxf(ctx, "already registered thread gdbm, skipping", "connStr", connStr)
return nil
} }
gdb := gdbmdb.NewGdbmDb() gdb := gdbmdb.NewGdbmDb()
err := gdb.Connect(ctx, connStr) err := gdb.Connect(ctx, connStr)
@ -39,7 +39,6 @@ func(tdb *ThreadGdbmDb) Connect(ctx context.Context, connStr string) error {
dbC[connStr] = make(chan db.Db, 1) dbC[connStr] = make(chan db.Db, 1)
dbC[connStr]<- gdb dbC[connStr]<- gdb
tdb.connStr = connStr tdb.connStr = connStr
tdb.registered = true
return nil return nil
} }