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=1acbe467159a0b7435602270342143b88b916dbf;p=plack-app-gruntmaster.git Require a delay of 30 seconds between jobs from a single user (cherry picked from commit 6a9aaf149c09cd2e8ae1332e4f50abbb946870c2) --- diff --git a/lib/Gruntmaster/Page/Submit.pm b/lib/Gruntmaster/Page/Submit.pm index 0159a9d..a30263b 100644 --- a/lib/Gruntmaster/Page/Submit.pm +++ b/lib/Gruntmaster/Page/Submit.pm @@ -33,6 +33,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;