Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
aaaff8bd
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
aaaff8bd
编写于
12月 07, 2017
作者:
D
Dvir Volk
提交者:
antirez
2月 15, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove the NOTIFY_MODULE flag and simplify the module notification flow if there aren't subscribers
上级
0be51b8f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
9 deletion
+5
-9
src/module.c
src/module.c
+4
-6
src/notify.c
src/notify.c
+1
-2
src/server.h
src/server.h
+0
-1
未找到文件。
src/module.c
浏览文件 @
aaaff8bd
...
...
@@ -3748,8 +3748,6 @@ int RM_SubscribeToKeyspaceEvents(RedisModuleCtx *ctx, int types, RedisModuleNoti
sub
->
notify_callback
=
callback
;
sub
->
active
=
0
;
/* Let the notification system know that modules are interested in notifications */
server
.
notify_keyspace_events
|=
NOTIFY_MODULE
;
listAddNodeTail
(
moduleKeyspaceSubscribers
,
sub
);
return
REDISMODULE_OK
;
...
...
@@ -3759,6 +3757,10 @@ int RM_SubscribeToKeyspaceEvents(RedisModuleCtx *ctx, int types, RedisModuleNoti
* This gets called only if at least one module requested to be notified on
* keyspace notifications */
void
moduleNotifyKeyspaceEvent
(
int
type
,
const
char
*
event
,
robj
*
key
,
int
dbid
)
{
/* Don't do anything if there aren't any subscribers */
if
(
listLength
(
moduleKeyspaceSubscribers
)
==
0
)
return
;
listIter
li
;
listNode
*
ln
;
...
...
@@ -3805,10 +3807,6 @@ void moduleUnsubscribeNotifications(RedisModule *module) {
zfree
(
sub
);
}
}
/* If no subscribers are left - do not call the module norification function */
if
(
listLength
(
moduleKeyspaceSubscribers
)
==
0
)
{
server
.
notify_keyspace_events
&=
~
NOTIFY_MODULE
;
}
}
...
...
src/notify.c
浏览文件 @
aaaff8bd
...
...
@@ -102,8 +102,7 @@ void notifyKeyspaceEvent(int type, char *event, robj *key, int dbid) {
* This bypasses the notifications configuration, but the module engine
* will only call event subscribers if the event type matches the types
* they are interested in. */
if
(
server
.
notify_keyspace_events
&
NOTIFY_MODULE
)
moduleNotifyKeyspaceEvent
(
type
,
event
,
key
,
dbid
);
moduleNotifyKeyspaceEvent
(
type
,
event
,
key
,
dbid
);
/* If notifications for this class of events are off, return ASAP. */
if
(
!
(
server
.
notify_keyspace_events
&
type
))
return
;
...
...
src/server.h
浏览文件 @
aaaff8bd
...
...
@@ -425,7 +425,6 @@ typedef long long mstime_t; /* millisecond time type. */
#define NOTIFY_ZSET (1<<7)
/* z */
#define NOTIFY_EXPIRED (1<<8)
/* x */
#define NOTIFY_EVICTED (1<<9)
/* e */
#define NOTIFY_MODULE (1<<11)
/* modules are interested in notifications */
#define NOTIFY_ALL (NOTIFY_GENERIC | NOTIFY_STRING | NOTIFY_LIST | NOTIFY_SET | NOTIFY_HASH | NOTIFY_ZSET | NOTIFY_EXPIRED | NOTIFY_EVICTED)
/* A flag */
/* Get the first bind addr or NULL */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录