]> git.itanic.dy.fi Git - rrdd/commitdiff
rrdtool_draw_image: Draw images in parallel
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 15 Apr 2012 18:20:35 +0000 (21:20 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sun, 15 Apr 2012 18:20:35 +0000 (21:20 +0300)
Use the do_fork_limited() to draw images in parallel while avoiding to
draw too many images at the same time.

Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
rrdtool.c

index 8c112052096404ff076f6abea58478822e5ff52c..b491b6e3b098ed71e155e3a49c4160d3ae2edd4a 100644 (file)
--- a/rrdtool.c
+++ b/rrdtool.c
@@ -42,6 +42,10 @@ int rrdtool_draw_image(struct rrd_image *image)
        char tmpfile[256];
        time_t t = time(0);
 
+       pid = do_fork_limited();
+       if (pid)
+               return pid;
+
        pr_info("Drawing image %s\n", image->image_filename);
 
        tmpfile[0] = 0;
@@ -92,7 +96,7 @@ int rrdtool_draw_image(struct rrd_image *image)
 
        rename(tmpfile, image->image_filename);
 
-       return 0;
+       exit(0);
 }
 
 int rrdtool_draw_images(struct rrd_image **image)