MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / scanDatabaseForReadyLists

Function scanDatabaseForReadyLists

src/db.cpp:1702–1711  ·  view source on GitHub ↗

Helper function for dbSwapDatabases(): scans the list of keys that have * one or more blocked clients for B[LR]POP or other blocking commands * and signal the keys as ready if they are of the right type. See the comment * where the function is used for more info. */

Source from the content-addressed store, hash-verified

1700 * and signal the keys as ready if they are of the right type. See the comment
1701 * where the function is used for more info. */
1702void scanDatabaseForReadyLists(redisDb *db) {
1703 dictEntry *de;
1704 dictIterator *di = dictGetSafeIterator(db->blocking_keys);
1705 while((de = dictNext(di)) != NULL) {
1706 robj *key = (robj*)dictGetKey(de);
1707 robj *value = lookupKey(db,key,LOOKUP_NOTOUCH);
1708 if (value) signalKeyAsReady(db, key, value->type);
1709 }
1710 dictReleaseIterator(di);
1711}
1712
1713/* Swap two databases at runtime so that all clients will magically see
1714 * the new database even if already connected. Note that the client

Callers 1

dbSwapDatabasesFunction · 0.85

Calls 5

dictGetSafeIteratorFunction · 0.85
lookupKeyFunction · 0.85
signalKeyAsReadyFunction · 0.85
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected