Streams: fix XREAD ready-key signaling.

With lists we need to signal only on key creation, but streams can
provide data to clients listening at every new item added.
To make this slightly more efficient we now track different classes of
blocked clients to avoid signaling keys when there is nobody listening.
A typical case is when the stream is used as a time series DB and
accessed only by range with XRANGE.
This commit is contained in:
antirez
2017-09-09 11:10:59 +02:00
parent b5be5093fe
commit 6468cb2e82
5 changed files with 14 additions and 7 deletions

View File

@ -169,8 +169,7 @@ void dbAdd(redisDb *db, robj *key, robj *val) {
int retval = dictAdd(db->dict, copy, val);
serverAssertWithInfo(NULL,key,retval == DICT_OK);
if (val->type == OBJ_LIST || val->type == OBJ_STREAM)
signalKeyAsReady(db, key);
if (val->type == OBJ_LIST) signalKeyAsReady(db, key);
if (server.cluster_enabled) slotToKeyAdd(key);
}