diff --git a/mxqd.c b/mxqd.c index a0c45ea4..71a7472d 100644 --- a/mxqd.c +++ b/mxqd.c @@ -2022,6 +2022,7 @@ static int fspool_process_file(struct mxq_server *server,char *filename, uint64_ struct mxq_job_list *jlist; struct mxq_job *job; struct mxq_group *group; + int slots_returned = 0; in=fopen(filename,"r"); if (!in) { @@ -2088,12 +2089,12 @@ static int fspool_process_file(struct mxq_server *server,char *filename, uint64_ job->stats_status = status; job->stats_rusage = rusage; - job_has_finished(server, group, jlist); + slots_returned = job_has_finished(server, group, jlist); unlink(filename); res = server_update_daemon_statistics(server); if (res < 0) mx_log_err("recover: failed to update daemon instance statistics: %m"); - return(0); + return(slots_returned); } static int fspool_is_valid_name_parse(const char *name, unsigned long long int *job_id) { @@ -2127,6 +2128,7 @@ static int fspool_scan(struct mxq_server *server) { int res; unsigned long long int job_id; char *filename; + int slots_returned = 0; entries=scandir(server->finished_jobsdir,&namelist,&fspool_is_valid_name,&alphasort); @@ -2139,15 +2141,15 @@ static int fspool_scan(struct mxq_server *server) { mx_asprintf_forever(&filename,"%s/%s",server->finished_jobsdir,namelist[i]->d_name); fspool_is_valid_name_parse(namelist[i]->d_name,&job_id); res=fspool_process_file(server,filename,job_id); - if (res==0) { - cnt++; + if (res>0) { + slots_returned += res; } free(namelist[i]); free(filename); } free(namelist); - return cnt; + return slots_returned; } static int file_exists(char *name) { @@ -2697,7 +2699,7 @@ int main(int argc, char *argv[]) slots_returned += fspool_scan(server); if (slots_returned) - mx_log_info("slots_returned=%lu :: Main Loop freed %lu slots.", slots_returned, slots_returned); + mx_log_info("Main loop freed %lu slots.", slots_returned); group_cnt = load_running_groups(server); if (group_cnt)