r7252 - dumbhippo/trunk/server/src/com/dumbhippo/polling



Author: walters
Date: 2008-01-23 14:05:31 -0600 (Wed, 23 Jan 2008)
New Revision: 7252

Modified:
   dumbhippo/trunk/server/src/com/dumbhippo/polling/SwarmPollingSystem.java
Log:
Add a throttling variable that we can tweak at runtime.


Modified: dumbhippo/trunk/server/src/com/dumbhippo/polling/SwarmPollingSystem.java
===================================================================
--- dumbhippo/trunk/server/src/com/dumbhippo/polling/SwarmPollingSystem.java	2008-01-23 18:43:28 UTC (rev 7251)
+++ dumbhippo/trunk/server/src/com/dumbhippo/polling/SwarmPollingSystem.java	2008-01-23 20:05:31 UTC (rev 7252)
@@ -39,6 +39,9 @@
 	@SuppressWarnings("unused")
 	private static final Logger logger = GlobalSetup.getLogger(SwarmPollingSystem.class);
 	
+	// The intent of this variable is to be tweaked from the admin shell at runtime.
+	private double THROTTLE_FACTOR = 1.0;
+	
 	private static final int MIN_TASK_PERIODICITY_SEC = 7 * 60; // 7 minutes
 	private static final int MAX_TASK_PERIODICITY_SEC = 2 * 60 * 60; // 2 hours
 	
@@ -177,6 +180,7 @@
 					scheduleSecs = task.rescheduleSeconds(result, scheduleSecs);
 					scheduleSecs = Math.max(scheduleSecs, MIN_TASK_PERIODICITY_SEC);
 					scheduleSecs = Math.min(scheduleSecs, MAX_TASK_PERIODICITY_SEC);
+					scheduleSecs = (long) (THROTTLE_FACTOR * scheduleSecs);
 
 					logger.debug("Rescheduling task {} in {} seconds (+ 0-10% fuzz)", task, scheduleSecs);
 					long scheduleOffsetMs = (long) (Math.random() * scheduleSecs * 1000.0 * 0.1);



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