From: Ruben Kerkhof Date: Sat, 28 Nov 2015 17:37:15 +0000 (+0100) Subject: write_redis: don't return with lock held X-Git-Tag: collectd-5.5.1~8 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b35ef467c9c197dc481aaca9faeea703e60f379a;p=collectd.git write_redis: don't return with lock held --- diff --git a/src/write_redis.c b/src/write_redis.c index da5b7bbe..231738c5 100644 --- a/src/write_redis.c +++ b/src/write_redis.c @@ -73,10 +73,11 @@ static int wr_write (const data_set_t *ds, /* {{{ */ value_size = sizeof (value); value_ptr = &value[0]; status = format_values (value_ptr, value_size, ds, vl, /* store rates = */ 0); - pthread_mutex_lock (&node->lock); if (status != 0) return (status); + pthread_mutex_lock (&node->lock); + if (node->conn == NULL) { node->conn = redisConnectWithTimeout ((char *)node->host, node->port, node->timeout);