Skip to content

Commit

Permalink
Merge pull request #64 from donald/work
Browse files Browse the repository at this point in the history
mxqd: Enforce minimum job runtime of 30 seconds
  • Loading branch information
donald authored Jul 6, 2017
2 parents 844fd6c + 37bc8b1 commit 99037e2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,13 @@ int reaper_process(struct mxq_server *server,struct mxq_group_list *glist, struc
}
gettimeofday(&now, NULL);
timersub(&now, &job->stats_starttime, &realtime);

if (realtime.tv_sec<30) {
int wait=30-realtime.tv_sec;
mx_log_warning("user process finished to fast (%ld seconds) : delaying termination for %d seconds",realtime.tv_sec,wait);
sleep(wait);
}

res = getrusage(RUSAGE_CHILDREN, &rusage);
if (res < 0) {
mx_log_err("reaper: getrusage: %m");
Expand Down

0 comments on commit 99037e2

Please sign in to comment.