[CalendarServer-changes] [15613] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 19 12:18:03 PDT 2016
Revision: 15613
http://trac.calendarserver.org//changeset/15613
Author: sagen at apple.com
Date: 2016-05-19 12:18:03 -0700 (Thu, 19 May 2016)
Log Message:
-----------
Spread group refreshes out over a configurable amount of time
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/txdav/who/groups.py
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2016-05-19 17:16:31 UTC (rev 15612)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2016-05-19 19:18:03 UTC (rev 15613)
@@ -1052,6 +1052,9 @@
"Enabled": True,
"UpdateSeconds" : 300,
"UseDirectoryBasedDelegates" : False,
+ "InitialSchedulingDelaySeconds" : 10,
+ "BatchSize" : 100,
+ "BatchSchedulingIntervalSeconds" : 2,
},
"GroupAttendees" : {
Modified: CalendarServer/trunk/txdav/who/groups.py
===================================================================
--- CalendarServer/trunk/txdav/who/groups.py 2016-05-19 17:16:31 UTC (rev 15612)
+++ CalendarServer/trunk/txdav/who/groups.py 2016-05-19 19:18:03 UTC (rev 15613)
@@ -230,6 +230,9 @@
def __init__(
self, directory,
updateSeconds=600,
+ initialSchedulingDelaySeconds=10,
+ batchSize=100,
+ batchSchedulingIntervalSeconds=2,
useDirectoryBasedDelegates=False,
directoryBasedDelegatesSource=None,
cacheNotifier=None,
@@ -241,6 +244,9 @@
self.directoryBasedDelegatesSource = directoryBasedDelegatesSource
self.cacheNotifier = cacheNotifier
self.updateSeconds = updateSeconds
+ self.initialSchedulingDelaySeconds = initialSchedulingDelaySeconds
+ self.batchSize = batchSize
+ self.batchSchedulingIntervalSeconds = batchSchedulingIntervalSeconds
@inlineCallbacks
@@ -308,11 +314,19 @@
)
# For each of those groups, create a per-group refresh work item
+ futureSeconds = self.initialSchedulingDelaySeconds
+ i = 0
for groupUID in set(groupUIDs) - set(deletedGroupUIDs):
- self.log.debug("Enqueuing group refresh for {u}", u=groupUID)
- yield GroupRefreshWork.reschedule(txn, 0, groupUID=groupUID)
+ self.log.debug(
+ "Enqueuing group refresh for {u} in {sec} seconds",
+ u=groupUID, sec=futureSeconds
+ )
+ yield GroupRefreshWork.reschedule(txn, futureSeconds, groupUID=groupUID)
+ i += 1
+ if i % self.batchSize == 0:
+ i = 0
+ futureSeconds += self.batchSchedulingIntervalSeconds
-
@inlineCallbacks
def scheduleExternalAssignments(
self, txn, newAssignments, immediately=False
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160519/e149a963/attachment.html>
More information about the calendarserver-changes
mailing list