myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2013] branches/invitation_throttling/app/control


From: noreply
Subject: [myexperiment-hackers] [2013] branches/invitation_throttling/app/controllers: Throttling.
Date: Fri, 28 Nov 2008 10:46:16 -0500 (EST)

Revision
2013
Author
alekses6
Date
2008-11-28 10:46:16 -0500 (Fri, 28 Nov 2008)

Log Message

Throttling. Bug-fix. For non-periodic counters the system will report a permanent error (inability to perform an action) and advise contacting the team.

Modified Paths

Diff

Modified: branches/invitation_throttling/app/controllers/application.rb (2012 => 2013)


--- branches/invitation_throttling/app/controllers/application.rb	2008-11-28 14:19:13 UTC (rev 2012)
+++ branches/invitation_throttling/app/controllers/application.rb	2008-11-28 15:46:16 UTC (rev 2013)
@@ -116,14 +116,14 @@
       action_allowed = false if (limit.current_count >= limit.limit_max)
     end
     
-    # update counted for the "current" action
+    # update counter for the "current" action
     if action_allowed && update_counter
       limit.current_count += 1
     end
     limit.save # saves all changes (including counter resets, etc)
     
-    
-    return [action_allowed, (limit.reset_after - time_now)]
+    # return if action is allowed / denied and when the next reset is going to be (nil for non-periodic counters) 
+    return [action_allowed, (limit.reset_after ? (limit.reset_after - time_now) : nil)]
   end
   
   

Modified: branches/invitation_throttling/app/controllers/messages_controller.rb (2012 => 2013)


--- branches/invitation_throttling/app/controllers/messages_controller.rb	2008-11-28 14:19:13 UTC (rev 2012)
+++ branches/invitation_throttling/app/controllers/messages_controller.rb	2008-11-28 15:46:16 UTC (rev 2013)
@@ -97,8 +97,10 @@
     else
       # no more messages can be sent because of the activity limit
       respond_to do |format|
-        error_msg = "You have reached the message limit, "
-        if allowed_plus_timespan[1] <= 60
+        error_msg = "You can't send messages - your limit is reached, "
+        if allowed_plus_timespan[1].nil?
+          error_msg += "it will not be reset. Please contact myExperiment administration for details."
+        elsif allowed_plus_timespan[1] <= 60
           error_msg += "please try again within a couple of minutes"
         else
           error_msg += "it will be reset in " + formatted_timespan(allowed_plus_timespan[1])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]