From: Marius Gavrilescu Date: Wed, 26 Feb 2014 08:18:37 +0000 (+0200) Subject: Require a delay of 30 seconds between jobs from a single user X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=6a9aaf149c09cd2e8ae1332e4f50abbb946870c2;p=plack-app-gruntmaster.git Require a delay of 30 seconds between jobs from a single user --- diff --git a/lib/Gruntmaster/Page/Submit.pm b/lib/Gruntmaster/Page/Submit.pm index e537765..569fe91 100644 --- a/lib/Gruntmaster/Page/Submit.pm +++ b/lib/Gruntmaster/Page/Submit.pm @@ -24,6 +24,8 @@ sub generate{ die if defined $contest && $contest !~ /^\w+$/ ; die if defined $contest && (time > contest_end $contest); return reply 'A required parameter was not supplied' if grep { !defined } $problem, $format, $prog; + return reply 'You must wait 30 seconds between jobs' unless time > lastjob ($r->user) + 30; + set_lastjob $r->user; local $Gruntmaster::Data::contest = $contest if $contest;