Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
4d4db979
Unverified
Commit
4d4db979
authored
May 09, 2021
by
Huang Zhw
Committed by
GitHub
May 09, 2021
Browse files
Cleanup: sentinel config, latency extra time() (#8810)
parent
d32fd315
Changes
2
Show whitespace changes
Inline
Side-by-side
src/latency.c
View file @
4d4db979
...
@@ -137,7 +137,7 @@ void latencyAddSample(const char *event, mstime_t latency) {
...
@@ -137,7 +137,7 @@ void latencyAddSample(const char *event, mstime_t latency) {
return
;
return
;
}
}
ts
->
samples
[
ts
->
idx
].
time
=
time
(
NULL
)
;
ts
->
samples
[
ts
->
idx
].
time
=
now
;
ts
->
samples
[
ts
->
idx
].
latency
=
latency
;
ts
->
samples
[
ts
->
idx
].
latency
=
latency
;
ts
->
idx
++
;
ts
->
idx
++
;
...
...
src/sentinel.c
View file @
4d4db979
...
@@ -1845,24 +1845,21 @@ void loadSentinelConfigFromQueue(void) {
...
@@ -1845,24 +1845,21 @@ void loadSentinelConfigFromQueue(void) {
listNode
*
ln
;
listNode
*
ln
;
int
linenum
=
0
;
int
linenum
=
0
;
sds
line
=
NULL
;
sds
line
=
NULL
;
unsigned
int
j
;
/* if there is no sentinel_config entry, we can return immediately */
/* if there is no sentinel_config entry, we can return immediately */
if
(
server
.
sentinel_config
==
NULL
)
return
;
if
(
server
.
sentinel_config
==
NULL
)
return
;
/* loading from pre monitor config queue first to avoid dependency issues */
list
*
sentinel_configs
[
3
]
=
{
listRewind
(
server
.
sentinel_config
->
pre_monitor_cfg
,
&
li
);
server
.
sentinel_config
->
pre_monitor_cfg
,
while
((
ln
=
listNext
(
&
li
)))
{
server
.
sentinel_config
->
monitor_cfg
,
struct
sentinelLoadQueueEntry
*
entry
=
ln
->
value
;
server
.
sentinel_config
->
post_monitor_cfg
err
=
sentinelHandleConfiguration
(
entry
->
argv
,
entry
->
argc
);
};
if
(
err
)
{
/* loading from pre monitor config queue first to avoid dependency issues
linenum
=
entry
->
linenum
;
* loading from monitor config queue
line
=
entry
->
line
;
* loading from the post monitor config queue */
goto
loaderr
;
for
(
j
=
0
;
j
<
sizeof
(
sentinel_configs
)
/
sizeof
(
sentinel_configs
[
0
]);
j
++
)
{
}
listRewind
(
sentinel_configs
[
j
],
&
li
);
}
/* loading from monitor config queue */
listRewind
(
server
.
sentinel_config
->
monitor_cfg
,
&
li
);
while
((
ln
=
listNext
(
&
li
)))
{
while
((
ln
=
listNext
(
&
li
)))
{
struct
sentinelLoadQueueEntry
*
entry
=
ln
->
value
;
struct
sentinelLoadQueueEntry
*
entry
=
ln
->
value
;
err
=
sentinelHandleConfiguration
(
entry
->
argv
,
entry
->
argc
);
err
=
sentinelHandleConfiguration
(
entry
->
argv
,
entry
->
argc
);
...
@@ -1872,17 +1869,6 @@ void loadSentinelConfigFromQueue(void) {
...
@@ -1872,17 +1869,6 @@ void loadSentinelConfigFromQueue(void) {
goto
loaderr
;
goto
loaderr
;
}
}
}
}
/* loading from the post monitor config queue */
listRewind
(
server
.
sentinel_config
->
post_monitor_cfg
,
&
li
);
while
((
ln
=
listNext
(
&
li
)))
{
struct
sentinelLoadQueueEntry
*
entry
=
ln
->
value
;
err
=
sentinelHandleConfiguration
(
entry
->
argv
,
entry
->
argc
);
if
(
err
)
{
linenum
=
entry
->
linenum
;
line
=
entry
->
line
;
goto
loaderr
;
}
}
}
/* free sentinel_config when config loading is finished */
/* free sentinel_config when config loading is finished */
...
...
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