Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
95242ab5
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,体验更适合开发者的 AI 搜索 >>
提交
95242ab5
编写于
12月 29, 2009
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
first working implementation of BLPOP and BRPOP, still everything is to test well
上级
9fe33a0e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
8 deletion
+9
-8
redis.c
redis.c
+9
-8
未找到文件。
redis.c
浏览文件 @
95242ab5
...
...
@@ -3524,7 +3524,10 @@ static void pushGenericCommand(redisClient *c, int where) {
lobj
=
lookupKeyWrite
(
c
->
db
,
c
->
argv
[
1
]);
if
(
lobj
==
NULL
)
{
if
(
handleClientsWaitingListPush
(
c
,
c
->
argv
[
1
],
c
->
argv
[
2
]))
return
;
if
(
handleClientsWaitingListPush
(
c
,
c
->
argv
[
1
],
c
->
argv
[
2
]))
{
addReply
(
c
,
shared
.
ok
);
return
;
}
lobj
=
createListObject
();
list
=
lobj
->
ptr
;
if
(
where
==
REDIS_HEAD
)
{
...
...
@@ -3540,7 +3543,10 @@ static void pushGenericCommand(redisClient *c, int where) {
addReply
(
c
,
shared
.
wrongtypeerr
);
return
;
}
if
(
handleClientsWaitingListPush
(
c
,
c
->
argv
[
1
],
c
->
argv
[
2
]))
return
;
if
(
handleClientsWaitingListPush
(
c
,
c
->
argv
[
1
],
c
->
argv
[
2
]))
{
addReply
(
c
,
shared
.
ok
);
return
;
}
list
=
lobj
->
ptr
;
if
(
where
==
REDIS_HEAD
)
{
listAddNodeHead
(
list
,
c
->
argv
[
2
]);
...
...
@@ -5462,7 +5468,7 @@ static void execCommand(redisClient *c) {
* empty we need to block. In order to do so we remove the notification for
* new data to read in the client socket (so that we'll not serve new
* requests if the blocking request is not served). Also we put the client
* in a dictionary (
server.
blockingkeys) mapping keys to a list of clients
* in a dictionary (
db->
blockingkeys) mapping keys to a list of clients
* blocking for this keys.
* - If a PUSH operation against a key with blocked clients waiting is
* performed, we serve the first in the list: basically instead to push
...
...
@@ -5479,7 +5485,6 @@ static void blockForKey(redisClient *c, robj *key, time_t timeout) {
dictEntry
*
de
;
list
*
l
;
printf
(
"blockForKey %p %s
\n
"
,
c
,
key
->
ptr
);
c
->
blockingkey
=
key
;
incrRefCount
(
key
);
c
->
blockingto
=
timeout
;
...
...
@@ -5504,7 +5509,6 @@ static void unblockClient(redisClient *c) {
dictEntry
*
de
;
list
*
l
;
printf
(
"unblockClient %p %s
\n
"
,
c
,
c
->
blockingkey
->
ptr
);
/* Remove this client from the list of clients waiting for this key. */
assert
(
c
->
blockingkey
!=
NULL
);
de
=
dictFind
(
c
->
db
->
blockingkeys
,
c
->
blockingkey
);
...
...
@@ -5554,9 +5558,6 @@ static int handleClientsWaitingListPush(redisClient *c, robj *key, robj *ele) {
ln
=
listFirst
(
l
);
assert
(
ln
!=
NULL
);
receiver
=
ln
->
value
;
listDelNode
(
l
,
ln
);
if
(
listLength
(
l
)
==
0
)
dictDelete
(
c
->
db
->
blockingkeys
,
key
);
addReplyBulkLen
(
receiver
,
ele
);
addReply
(
receiver
,
ele
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录