Skip to content

Commit

Permalink
Rename count_running_jobs to AreMaxConcurrentJobsExceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and franku committed Sep 20, 2018
1 parent 4f20a9f commit 5f9e616
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions core/src/filed/dir_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,7 @@ static inline void CleanupFileset(JobControlRecord *jcr)
jcr->ff->fileset = NULL;
}

/**
* Count the number of running jobs.
*/
static inline bool count_running_jobs()
static inline bool AreMaxConcurrentJobsExceeded()
{
JobControlRecord *jcr;
unsigned int cnt = 0;
Expand All @@ -457,7 +454,7 @@ static inline bool count_running_jobs()
}
endeach_jcr(jcr);

return (cnt >= me->MaxConcurrentJobs) ? false : true;
return (cnt >= me->MaxConcurrentJobs) ? true : false;
}

JobControlRecord *create_new_director_session(BareosSocket *dir)
Expand Down Expand Up @@ -640,7 +637,7 @@ void *handle_director_connection(BareosSocket *dir)
PreventOsSuspensions();
#endif

if (!count_running_jobs()) {
if (AreMaxConcurrentJobsExceeded()) {
Emsg0(M_ERROR, 0, _("Number of Jobs exhausted, please increase MaximumConcurrentJobs\n"));
return NULL;
}
Expand Down
9 changes: 3 additions & 6 deletions core/src/stored/dir_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,7 @@ static struct s_cmds cmds[] = {
{ NULL, NULL, false } /**< list terminator */
};

/*
* Count the number of running jobs.
*/
static inline bool count_running_jobs()
static inline bool AreMaxConcurrentJobsExceeded()
{
JobControlRecord *jcr;
unsigned int cnt = 0;
Expand All @@ -221,7 +218,7 @@ static inline bool count_running_jobs()
}
endeach_jcr(jcr);

return (cnt >= me->MaxConcurrentJobs) ? false : true;
return (cnt >= me->MaxConcurrentJobs) ? true : false;
}

/**
Expand All @@ -241,7 +238,7 @@ void *HandleDirectorConnection(BareosSocket *dir)
int bnet_stat = 0;
bool found, quit;

if (!count_running_jobs()) {
if (AreMaxConcurrentJobsExceeded()) {
Emsg0(M_ERROR, 0, _("Number of Jobs exhausted, please increase MaximumConcurrentJobs\n"));
dir->signal(BNET_TERMINATE);
return NULL;
Expand Down

0 comments on commit 5f9e616

Please sign in to comment.