Skip to content

Commit

Permalink
loadctl: Update last_check when we actually check the load
Browse files Browse the repository at this point in the history
Otherwise we'll be spamming the logs like crazy.

Signed-off-by: Andreas Ericsson <[email protected]>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2447 5f96b256-904b-4d8d-8c98-d829582c6739
  • Loading branch information
ageric committed Nov 2, 2012
1 parent fb35578 commit ddd538e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion base/workers.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ void wproc_reap(int jobs, int msecs)
int wproc_can_spawn(struct load_control *lc)
{
unsigned int old = 0;
time_t now;

/* if no load control is enabled, we can safely run this job */
if (!(lc->options & LOADCTL_ENABLED))
return 1;

if (lc->check_interval < time(NULL) - lc->last_check) {
now = time(NULL);
if (lc->last_check + lc->check_interval > now) {
lc->last_check = now;

if (getloadavg(lc->load, 3) < 0)
return lc->jobs_limit < lc->jobs_running;

Expand Down

0 comments on commit ddd538e

Please sign in to comment.