Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
ee982f40
Commit
ee982f40
authored
Mar 31, 2018
by
antirez
Browse files
Modules Timer API: Wait at least 1 ms per iteration. Convert to ms.
parent
4c11bc6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/module.c
View file @
ee982f40
...
@@ -4076,13 +4076,14 @@ int moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *client
...
@@ -4076,13 +4076,14 @@ int moduleTimerHandler(struct aeEventLoop *eventLoop, long long id, void *client
raxRemove
(
Timers
,(
unsigned
char
*
)
ri
.
key
,
ri
.
key_len
,
NULL
);
raxRemove
(
Timers
,(
unsigned
char
*
)
ri
.
key
,
ri
.
key_len
,
NULL
);
zfree
(
timer
);
zfree
(
timer
);
}
else
{
}
else
{
next_period
=
expiretime
-
now
;
next_period
=
(
expiretime
-
now
)
/
1000
;
/* Scale to milliseconds. */
break
;
break
;
}
}
}
}
raxStop
(
&
ri
);
raxStop
(
&
ri
);
/* Reschedule the next timer or cancel it. */
/* Reschedule the next timer or cancel it. */
if
(
next_period
<=
0
)
next_period
=
1
;
return
(
raxSize
(
Timers
)
>
0
)
?
next_period
:
AE_NOMORE
;
return
(
raxSize
(
Timers
)
>
0
)
?
next_period
:
AE_NOMORE
;
}
}
...
@@ -4160,7 +4161,7 @@ int RM_GetTimerInfo(RedisModuleCtx *ctx, RedisModuleTimerID id, uint64_t *remain
...
@@ -4160,7 +4161,7 @@ int RM_GetTimerInfo(RedisModuleCtx *ctx, RedisModuleTimerID id, uint64_t *remain
if
(
remaining
)
{
if
(
remaining
)
{
int64_t
rem
=
ntohu64
(
id
)
-
ustime
();
int64_t
rem
=
ntohu64
(
id
)
-
ustime
();
if
(
rem
<
0
)
rem
=
0
;
if
(
rem
<
0
)
rem
=
0
;
*
remaining
=
rem
;
*
remaining
=
rem
/
1000
;
/* Scale to milliseconds. */
}
}
if
(
data
)
*
data
=
timer
->
data
;
if
(
data
)
*
data
=
timer
->
data
;
return
REDISMODULE_OK
;
return
REDISMODULE_OK
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment