Merge branch 'collectd-5.4' into collectd-5.5
[collectd.git] / src / write_redis.c
index da5b7bb..231738c 100644 (file)
@@ -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);