| | 105 | # Try to police the number of concurrent rrdgraph instances. The |
|---|
| | 106 | # third value is the default maximum. |
|---|
| | 107 | |
|---|
| | 108 | # NOTE: The munin_*lock functions are not exactly ideal for race prone |
|---|
| | 109 | # locking, they're a bit fuzzy. A better solution, which would not |
|---|
| | 110 | # imply a "sleep 1" would be to use semaphores. See "perldoc perlipc" |
|---|
| | 111 | # and "man semop". |
|---|
| | 112 | |
|---|
| | 113 | my $max_cgi_graph_jobs = &munin_get ($config, "max_cgi_graph_jobs" , 6, $dom); |
|---|
| | 114 | |
|---|
| | 115 | until ( $lock ) { |
|---|
| | 116 | foreach my $n ( 1 .. $max_cgi_graph_jobs ) { |
|---|
| | 117 | if (&munin_getlock ("$config->{rundir}/munin-cgi-graph-$n.lock")) { |
|---|
| | 118 | $lock = "munin-cgi-graph-$n.lock"; |
|---|
| | 119 | last; |
|---|
| | 120 | } |
|---|
| | 121 | } |
|---|
| | 122 | sleep 1; |
|---|
| | 123 | } |
|---|