a little optimization in touchAllWatchedKeysInDb (#9200)
touch keys only if the key is in one of the dbs, in case rewind the list when the key doesn't exist.
This commit is contained in:
parent
f06d782f5a
commit
5ea3c3db15
16
src/multi.c
16
src/multi.c
@ -380,14 +380,14 @@ void touchAllWatchedKeysInDb(redisDb *emptied, redisDb *replaced_with) {
|
||||
dictIterator *di = dictGetSafeIterator(emptied->watched_keys);
|
||||
while((de = dictNext(di)) != NULL) {
|
||||
robj *key = dictGetKey(de);
|
||||
list *clients = dictGetVal(de);
|
||||
if (!clients) continue;
|
||||
listRewind(clients,&li);
|
||||
while((ln = listNext(&li))) {
|
||||
client *c = listNodeValue(ln);
|
||||
if (dictFind(emptied->dict, key->ptr)) {
|
||||
c->flags |= CLIENT_DIRTY_CAS;
|
||||
} else if (replaced_with && dictFind(replaced_with->dict, key->ptr)) {
|
||||
if (dictFind(emptied->dict, key->ptr) ||
|
||||
(replaced_with && dictFind(replaced_with->dict, key->ptr)))
|
||||
{
|
||||
list *clients = dictGetVal(de);
|
||||
if (!clients) continue;
|
||||
listRewind(clients,&li);
|
||||
while((ln = listNext(&li))) {
|
||||
client *c = listNodeValue(ln);
|
||||
c->flags |= CLIENT_DIRTY_CAS;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user