SVN: toys/stbr/stbr.tcl

sparky sparky at pld-linux.org
Sat Feb 6 17:17:49 CET 2010


Author: sparky
Date: Sat Feb  6 17:17:49 2010
New Revision: 11127

Modified:
   toys/stbr/stbr.tcl
Log:
- limit to 3 requests / 60 seconds


Modified: toys/stbr/stbr.tcl
==============================================================================
--- toys/stbr/stbr.tcl	(original)
+++ toys/stbr/stbr.tcl	Sat Feb  6 17:17:49 2010
@@ -113,7 +113,7 @@
 }
 
 proc rthx {} {
-	set answer {"luz" "luzik" "nie ma sprawy" "spoko" "no problem" "n/p" "dla ciebie zawsze z mila checia"}
+	set answer {"y/w" "luz" "luzik" "nie ma sprawy" "spoko" "no problem" "n/p" "dla ciebie zawsze z mila checia"}
 	set range [llength $answer]
 	set whichone [expr {int(rand()*$range)}]
 	return [lindex $answer $whichone]
@@ -301,7 +301,6 @@
 	putserv "privmsg $chan :$nick: $usage"; return 0
 }
 if {([string length $third]<2)} {putserv "privmsg $chan :$nick: $usage"; return 0}
-if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; putserv "privmsg $chan :$nick: I reached my STBR time limit (30sec). Please try later."; return 0}
 if {([string match noupgrade $second])} {set second "test-build"}
 foreach spec $specs {
 if {([string match */* $spec])} {
@@ -387,6 +386,15 @@
 lappend rspecs $spec; append rspecs ":$branch (to $towho, options: $bconds_with $bconds_without $defines)"
 lappend tspecs $spec; append tspecs ":$branch (options: $bconds_with $bconds_without $defines)"
 }
+
+if {$cntr<3} {
+	incr cntr
+	utimer 60 "incr cntr -1"
+} {
+	putserv "privmsg $chan :$nick: I reached my STBR time limit (3 requests in 60sec). Please try later."
+	return 0
+}
+
 if {([string match test-build $second])} {
 	if {[utimer 5 "exec $makereq -d $dist -t $bconds_with $bconds_without $defines $spec:$branch >/dev/null 2>&1"]==0} {putserv "privmsg $chan :$nick: An error occured. Couldn't send test-build request for $spec to builders."; return 1}
 	exec sqlite $logfile "INSERT INTO application VALUES('$date','$spec','$branch','stbr','$second','$dist');"
@@ -406,7 +414,6 @@
 } {
 	putserv "privmsg $chan :$nick: Sent STBR Mail for $rspecs. A ready-build will be performed on PLD-$dist line. Visit http://stbr.pld-linux.org/?show=$nick&date=$day$space$hour to track your request."
 }
-if {$cntr<1} {incr cntr} {utimer 30 "set cntr 0"; return 1}
 }
 
 putlog "$versionstr loaded."


More information about the pld-cvs-commit mailing list