Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
84b7a8e6
Commit
84b7a8e6
authored
May 05, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
safely set the monitoring interval for the Kafka MQ plugin
parent
ee16f13e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
monitor.c
src/mq/kafka/monitor.c
+7
-7
mq.c
src/mq/kafka/mq.c
+1
-1
mq_kafka.h
src/mq/kafka/mq_kafka.h
+1
-1
No files found.
src/mq/kafka/monitor.c
View file @
84b7a8e6
...
@@ -75,13 +75,13 @@ static void
...
@@ -75,13 +75,13 @@ static void
*
monitor_thread
(
void
*
arg
)
*
monitor_thread
(
void
*
arg
)
{
{
struct
timespec
t
;
struct
timespec
t
;
unsigned
interval
=
*
((
unsigned
*
)
arg
)
;
(
void
)
arg
;
AN
(
interval
);
AN
(
stats_
interval
);
/* Convert ms -> struct timespec */
/* Convert ms -> struct timespec */
t
.
tv_sec
=
(
time_t
)
interval
/
1e3
;
t
.
tv_sec
=
(
time_t
)
stats_
interval
/
1e3
;
t
.
tv_nsec
=
(
interval
%
(
unsigned
)
1e3
)
*
1e6
;
t
.
tv_nsec
=
(
stats_
interval
%
(
unsigned
)
1e3
)
*
1e6
;
MQ_LOG_Log
(
LOG_INFO
,
MQ_LOG_Log
(
LOG_INFO
,
"libtrackrdr-kafka monitor thread running every %u.%03lu secs"
,
"libtrackrdr-kafka monitor thread running every %u.%03lu secs"
,
t
.
tv_sec
,
t
.
tv_nsec
/
(
unsigned
long
)
1e6
);
t
.
tv_sec
,
t
.
tv_nsec
/
(
unsigned
long
)
1e6
);
...
@@ -118,11 +118,11 @@ static void
...
@@ -118,11 +118,11 @@ static void
}
}
int
int
MQ_MON_Init
(
unsigned
interval
)
MQ_MON_Init
(
void
)
{
{
if
(
interval
==
0
)
if
(
stats_
interval
==
0
)
return
0
;
return
0
;
return
pthread_create
(
&
monitor
,
NULL
,
monitor_thread
,
(
void
*
)
&
interval
);
return
pthread_create
(
&
monitor
,
NULL
,
monitor_thread
,
NULL
);
}
}
void
void
...
...
src/mq/kafka/mq.c
View file @
84b7a8e6
...
@@ -161,7 +161,7 @@ MQ_GlobalInit(unsigned nworkers, const char *config_fname)
...
@@ -161,7 +161,7 @@ MQ_GlobalInit(unsigned nworkers, const char *config_fname)
}
}
if
(
stats_interval
!=
0
)
{
if
(
stats_interval
!=
0
)
{
int
err
=
MQ_MON_Init
(
stats_interval
);
int
err
=
MQ_MON_Init
();
if
(
err
!=
0
)
{
if
(
err
!=
0
)
{
snprintf
(
errmsg
,
LINE_MAX
,
"Cannot start monitoring thread: %s"
,
snprintf
(
errmsg
,
LINE_MAX
,
"Cannot start monitoring thread: %s"
,
strerror
(
err
));
strerror
(
err
));
...
...
src/mq/kafka/mq_kafka.h
View file @
84b7a8e6
...
@@ -77,7 +77,7 @@ void MQ_LOG_SetLevel(int level);
...
@@ -77,7 +77,7 @@ void MQ_LOG_SetLevel(int level);
void
MQ_LOG_Close
(
void
);
void
MQ_LOG_Close
(
void
);
/* monitor.c */
/* monitor.c */
int
MQ_MON_Init
(
unsigned
interval
);
int
MQ_MON_Init
(
void
);
void
MQ_MON_Fini
(
void
);
void
MQ_MON_Fini
(
void
);
/* zookeeper.c */
/* zookeeper.c */
...
...
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