Code

Replaced 'interval_g' with 'plugin_interval' where and when necessary.
[collectd.git] / src / memcached.c
index ee3dbe12d67c4998b3ac65ede2f808016370023f..228beada48491632e474ef87fe9ee058ed0b197f 100644 (file)
@@ -177,13 +177,15 @@ static int memcached_query_daemon (char *buffer, int buffer_size) /* {{{ */
                p.revents = 0;
 
                status = poll (&p, /* nfds = */ 1,
-                               /* timeout = */ CDTIME_T_TO_MS (interval_g));
+                               /* timeout = */ CDTIME_T_TO_MS ((plugin_interval > 0)
+                                       ? plugin_interval : interval_g));
                if (status <= 0)
                {
                        if (status == 0)
                        {
                                ERROR ("memcached: poll(2) timed out after %.3f seconds.",
-                                               CDTIME_T_TO_DOUBLE (interval_g));
+                                               CDTIME_T_TO_DOUBLE ((plugin_interval > 0)
+                                                       ? plugin_interval : interval_g));
                        }
                        else
                        {
@@ -277,7 +279,7 @@ static void submit_derive (const char *type, const char *type_inst,
                derive_t value) /* {{{ */
 {
        value_t values[1];
-       value_list_t vl = VALUE_LIST_INIT;
+       value_list_t vl = VALUE_LIST_INIT (plugin_interval);
 
        values[0].derive = value;
 
@@ -297,7 +299,7 @@ static void submit_derive2 (const char *type, const char *type_inst,
                derive_t value0, derive_t value1) /* {{{ */
 {
        value_t values[2];
-       value_list_t vl = VALUE_LIST_INIT;
+       value_list_t vl = VALUE_LIST_INIT (plugin_interval);
 
        values[0].derive = value0;
        values[1].derive = value1;
@@ -318,7 +320,7 @@ static void submit_gauge (const char *type, const char *type_inst,
                gauge_t value) /* {{{ */
 {
        value_t values[1];
-       value_list_t vl = VALUE_LIST_INIT;
+       value_list_t vl = VALUE_LIST_INIT (plugin_interval);
 
        values[0].gauge = value;
 
@@ -338,7 +340,7 @@ static void submit_gauge2 (const char *type, const char *type_inst,
                gauge_t value0, gauge_t value1) /* {{{ */
 {
        value_t values[2];
-       value_list_t vl = VALUE_LIST_INIT;
+       value_list_t vl = VALUE_LIST_INIT (plugin_interval);
 
        values[0].gauge = value0;
        values[1].gauge = value1;
@@ -514,10 +516,12 @@ static int memcached_read (void) /* {{{ */
 }
 /* }}} */
 
-void module_register (void) /* {{{ */
+void module_register (plugin_loaddata_t *data) /* {{{ */
 {
+       PLUGIN_INIT_INTERVAL (data);
+
        plugin_register_config ("memcached", memcached_config, config_keys, config_keys_num);
-       plugin_register_read ("memcached", memcached_read);
+       plugin_register_read ("memcached", memcached_read, plugin_interval);
 }
 /* }}} */