summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 608d54d)
raw | patch | inline | side by side (parent: 608d54d)
author | Florian Forster <octo@collectd.org> | |
Wed, 29 Feb 2012 22:11:26 +0000 (23:11 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 29 Feb 2012 22:11:26 +0000 (23:11 +0100) |
Change-Id: I8eb1bc53a15cd301d663e55a5ea71e46013f04c5
src/write_mongodb.c | patch | blob | history |
diff --git a/src/write_mongodb.c b/src/write_mongodb.c
index 3b17f8c84e41e5668d834f0cca0a04b552814b70..f61d6224f09705cb75efc425f37a7a03d89aea72 100644 (file)
--- a/src/write_mongodb.c
+++ b/src/write_mongodb.c
mongo_destroy(node->conn);
pthread_mutex_unlock (&node->lock);
return (-1);
- } else {
- node->connected = 1;
}
+
+ if (node->timeout > 0) {
+ status = mongo_set_op_timeout (node->conn, node->timeout);
+ if (status != MONGO_OK) {
+ WARNING ("write_mongodb plugin: mongo_set_op_timeout(%i) failed: %s",
+ node->timeout, node->conn->errstr);
+ }
+ }
+
+ node->connected = 1;
}
/* Assert if the connection has been established */
return (ENOMEM);
memset (node, 0, sizeof (*node));
node->host = NULL;
- node->port = 0;
- node->timeout = 1000;
- node->connected = 0;
node->store_rates = 1;
pthread_mutex_init (&node->lock, /* attr = */ NULL);