Commit cfd20fd9 authored by Nicolas Delaby's avatar Nicolas Delaby

Use priority for activities

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24133 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a3e20c00
......@@ -230,8 +230,10 @@ class Publication(Subscription):
"""
Reset all subscribers
"""
for o in self.getSubscriberList():
self.activate(activity='SQLQueue', tag=self.getId()).manage_delObjects(o.id)
id_list = [o.id for o in self.getSubscriberList()]
self.activate(activity='SQLQueue',
tag=self.getId(),
priority=self.PRIORITY).manage_delObjects(id_list)
def getConflictList(self):
"""
......
......@@ -1342,10 +1342,11 @@ class Subscription(Folder, XMLSyncUtils):
"""
object_id_list = [id for id in self.getObjectIds()]
object_list_len = len(object_id_list)
for i in xrange(0, object_list_len, 100):
current_id_list = object_id_list[i:i+100]
for i in xrange(0, object_list_len, self.MAX_OBJECTS):
current_id_list = object_id_list[i:i+self.MAX_OBJECTS]
self.activate(activity='SQLQueue',
tag = self.getId()).manage_delObjects(current_id_list)
tag=self.getId(),
priority=self.PRIORITY).manage_delObjects(current_id_list)
def getConflictList(self):
"""
......
......@@ -129,3 +129,6 @@ class SyncCode(Persistent):
CONTENT_TYPE = {}
CONTENT_TYPE['SYNCML_XML'] = 'application/vnd.syncml+xml'
CONTENT_TYPE['SYNCML_WBXML'] = 'application/vnd.syncml+wbxml'
#Activity priority
PRIORITY = 5
......@@ -858,7 +858,8 @@ class SynchronizationTool( SubscriptionSynchronization,
#LOG('sendResponse, will start sendHttpResponse, xml', DEBUG, '')
activity = self.getActivityType(domain=domain)
self.activate(activity=activity,
tag = domain.getId()).sendHttpResponse(
tag=domain.getId(),
priority=self.PRIORITY).sendHttpResponse(
sync_id=sync_id,
to_url=to_url,
xml=xml,
......@@ -939,7 +940,8 @@ class SynchronizationTool( SubscriptionSynchronization,
except socket.error, msg:
activity = self.getActivityType(domain=domain)
self.activate(activity=activity,
tag = domain.getId()).sendHttpResponse(
tag=domain.getId(),
priority=self.PRIORITY).sendHttpResponse(
to_url=to_url,
sync_id=sync_id,
xml=xml,
......@@ -976,7 +978,8 @@ class SynchronizationTool( SubscriptionSynchronization,
newSecurityManager(None, user)
activity = self.getActivityType(domain=subscription)
subscription.activate(activity=activity,
tag = subscription.getId()
tag=subscription.getId(),
priority=self.PRIORITY
).SubSync(subscription.getPath())
security.declarePublic('readResponse')
......@@ -1038,7 +1041,8 @@ class SynchronizationTool( SubscriptionSynchronization,
#use activities to send SyncML data.
activity = self.getActivityType(domain=publication)
publication.activate(activity=activity,
tag=publication.getId()).PubSync(
tag=publication.getId(),
priority=self.PRIORITY).PubSync(
publication.getPath(),
text)
return ' '
......@@ -1056,7 +1060,8 @@ class SynchronizationTool( SubscriptionSynchronization,
subscription_path = subscription.getPath()
activity = self.getActivityType(domain=subscription)
self.activate(activity=activity,
tag=subscription.getId()).SubSync(
tag=subscription.getId(),
priority=self.PRIORITY).SubSync(
subscription_path,
text)
return ' '
......
......@@ -1453,17 +1453,18 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
PrettyPrint(remote_xml,stream=string_io)
remote_xml = string_io.getvalue()
domain.activate(activity='SQLQueue',
tag=domain.getId()).activateSyncModif(
tag=domain.getId(),
priority=self.PRIORITY).activateSyncModif(
domain_relative_url = domain.getRelativeUrl(),
remote_xml = remote_xml,
subscriber_relative_url = subscriber.getRelativeUrl(),
cmd_id = cmd_id,
xml_confirmation = xml_confirmation,
syncml_data = '',
cmd_id_before_getsyncmldata = cmd_id_before_getsyncmldata,
xml_list = xml_list,
has_status_list = has_status_list,
has_response = has_response )
remote_xml=remote_xml,
subscriber_relative_url=subscriber.getRelativeUrl(),
cmd_id=cmd_id,
xml_confirmation=xml_confirmation,
syncml_data='',
cmd_id_before_getsyncmldata=cmd_id_before_getsyncmldata,
xml_list=xml_list,
has_status_list=has_status_list,
has_response=has_response )
return {'has_response':1, 'xml':''}
else:
result = self.getSyncMLData(domain=domain,
......@@ -1494,7 +1495,8 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
sliced_gid_list = [gid_list.pop() for i in gid_list[:self.MAX_OBJECTS]]
#Split List Processing in activities
self.activate(activity='SQLQueue',
tag=domain.getId()).activateDeleteRemainObjectList(domain_path,
tag=domain.getId(),
priority=self.PRIORITY).activateDeleteRemainObjectList(domain_path,
subscriber_path,
sliced_gid_list)
......@@ -1529,7 +1531,8 @@ class XMLSyncUtils(XMLSyncUtilsMixin):
finished = result['finished']
if not finished:
domain.activate(activity='SQLQueue',
tag=domain.getId()).activateSyncModif(**kw)
tag=domain.getId(),
priority=self.PRIORITY).activateSyncModif(**kw)
else:
xml_confirmation = result['xml_confirmation']
cmd_id = result['cmd_id']
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment