Skip to content

Commit

Permalink
mxqd: Limit call rate of killall_over_time() to max. every 5 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Oct 22, 2015
1 parent 259145a commit fa41df3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,11 @@ int killall_over_time(struct mxq_server *server)

assert(server);

/* limit killing to every >= 5 minutes */
mx_within_rate_limit_or_return(5*60, 1);

mx_log_info("killall_over_time: Sending signals to all jobs running longer than requested.");

gettimeofday(&now, NULL);

for (user=server->users; user; user=user->next) {
Expand Down Expand Up @@ -1906,7 +1911,6 @@ int main(int argc, char *argv[])
killallcancelled(&server, SIGTERM, 0);
killallcancelled(&server, SIGINT, 0);
killall_over_time(&server);
killall_over_time(&server);

mx_log_info("jobs_running=%lu global_sigint_cnt=%d global_sigterm_cnt=%d : Exiting. Wating for jobs to finish. Sleeping for a while.",
server.jobs_running, global_sigint_cnt, global_sigterm_cnt);
Expand Down

0 comments on commit fa41df3

Please sign in to comment.