Added some comments for index functions

This commit is contained in:
Trial97
2020-06-09 08:59:54 +03:00
committed by Dan Christian Bogos
parent 5a255e195a
commit 8dfdeb4522
2 changed files with 11 additions and 12 deletions

View File

@@ -110,7 +110,7 @@ func removeItemFromFilterIndex(dm DataManager, idxItmType, tnt, ctx, itemID stri
for idxKey, index := range indexes {
index.Remove(itemID)
if index.Size() == 0 { // empty index set it with nil for cache
indexes[idxKey] = nil
indexes[idxKey] = nil // this will not be set in DB(handled by driver)
}
}
tntCtx := tnt
@@ -128,7 +128,7 @@ func updatedIndexes(dm DataManager, idxItmType, tnt, ctx, itemID string, oldFilt
return
}
// do not update the filters if they are the same
// check what indexes needs to be updated
oldFltrs := utils.NewStringSet(*oldFilterIds)
newFltrs := utils.NewStringSet(newFilterIDs)

View File

@@ -132,17 +132,16 @@ func NewRedisStorage(address string, db int, pass, mrshlerStr string,
sentinelInsts: sentinelInsts,
db: db,
pass: pass}, nil
} else {
p, err := pool.NewCustom(utils.TCP, address, maxConns, df)
if err != nil {
return nil, err
}
return &RedisStorage{
dbPool: p,
maxConns: maxConns,
ms: ms,
}, nil
}
p, err := pool.NewCustom(utils.TCP, address, maxConns, df)
if err != nil {
return nil, err
}
return &RedisStorage{
dbPool: p,
maxConns: maxConns,
ms: ms,
}, nil
}
func reconnectSentinel(addr, sentinelName string, db int, pass string, maxConns int) (*sentinel.Client, error) {