Unwatch all the keys watched by this client. To clean the EXEC dirty * flag is up to the caller. */
| 332 | /* Unwatch all the keys watched by this client. To clean the EXEC dirty |
| 333 | * flag is up to the caller. */ |
| 334 | void unwatchAllKeys(client *c) { |
| 335 | listIter li; |
| 336 | listNode *ln; |
| 337 | |
| 338 | if (listLength(c->watched_keys) == 0) return; |
| 339 | listRewind(c->watched_keys,&li); |
| 340 | while((ln = listNext(&li))) { |
| 341 | list *clients; |
| 342 | watchedKey *wk; |
| 343 | |
| 344 | /* Lookup the watched key -> clients list and remove the client |
| 345 | * from the list */ |
| 346 | wk = (watchedKey*)listNodeValue(ln); |
| 347 | clients = (decltype(clients))dictFetchValue(wk->db->watched_keys, wk->key); |
| 348 | serverAssertWithInfo(c,NULL,clients != NULL); |
| 349 | listDelNode(clients,listSearchKey(clients,c)); |
| 350 | /* Kill the entry at all if this was the only client */ |
| 351 | if (listLength(clients) == 0) |
| 352 | dictDelete(wk->db->watched_keys, wk->key); |
| 353 | /* Remove this watched key from the client->watched list */ |
| 354 | listDelNode(c->watched_keys,ln); |
| 355 | decrRefCount(wk->key); |
| 356 | zfree(wk); |
| 357 | } |
| 358 | } |
| 359 | |
| 360 | /* iterates over the watched_keys list and |
| 361 | * look for an expired key . */ |
no test coverage detected