]> arthur.barton.de Git - netdata.git/blobdiff - src/backends.c
Merge pull request #1690 from ktsaou/master
[netdata.git] / src / backends.c
index 9b91b7f0a5ddac65bfc9b226977820045e0253d8..4250e31c4b2d89e95e551680886bfd61fc466d9d 100644 (file)
@@ -349,6 +349,10 @@ void *backends_main(void *ptr) {
         //fprintf(stderr, "\nBACKEND BEGIN:\n%s\nBACKEND END\n", buffer_tostring(b)); // FIXME
         //fprintf(stderr, "after = %lu, before = %lu\n", after, before);
 
+        // prepare for the next iteration
+        // to add incrementally data to buffer
+        after = before;
+
         // ------------------------------------------------------------------------
         // if we are connected, receive a response, without blocking
 
@@ -454,12 +458,6 @@ void *backends_main(void *ptr) {
                 close(sock);
                 sock = -1;
             }
-
-            // either the buffer is empty
-            // or is holding the data we couldn't send
-            // so, make sure the next iteration will continue
-            // from where we are now
-            after = before;
         }
         else {
             error("Failed to update database backend '%s'", destination);