[Erp5-report] r24133 - /erp5/trunk/products/ERP5SyncML/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Oct 10 12:43:34 CEST 2008


Author: nicolas
Date: Fri Oct 10 12:43:33 2008
New Revision: 24133

URL: http://svn.erp5.org?rev=24133&view=rev
Log:
Use priority for activities

Modified:
    erp5/trunk/products/ERP5SyncML/Publication.py
    erp5/trunk/products/ERP5SyncML/Subscription.py
    erp5/trunk/products/ERP5SyncML/SyncCode.py
    erp5/trunk/products/ERP5SyncML/SynchronizationTool.py
    erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py

Modified: erp5/trunk/products/ERP5SyncML/Publication.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Publication.py?rev=24133&r1=24132&r2=24133&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Publication.py (original)
+++ erp5/trunk/products/ERP5SyncML/Publication.py Fri Oct 10 12:43:33 2008
@@ -230,8 +230,10 @@
     """
       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):
     """

Modified: erp5/trunk/products/ERP5SyncML/Subscription.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Subscription.py?rev=24133&r1=24132&r2=24133&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Subscription.py (original)
+++ erp5/trunk/products/ERP5SyncML/Subscription.py Fri Oct 10 12:43:33 2008
@@ -1342,10 +1342,11 @@
     """
     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):
     """

Modified: erp5/trunk/products/ERP5SyncML/SyncCode.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/SyncCode.py?rev=24133&r1=24132&r2=24133&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/SyncCode.py (original)
+++ erp5/trunk/products/ERP5SyncML/SyncCode.py Fri Oct 10 12:43:33 2008
@@ -129,3 +129,6 @@
   CONTENT_TYPE = {}
   CONTENT_TYPE['SYNCML_XML'] = 'application/vnd.syncml+xml'
   CONTENT_TYPE['SYNCML_WBXML'] = 'application/vnd.syncml+wbxml'
+
+  #Activity priority
+  PRIORITY = 5

Modified: erp5/trunk/products/ERP5SyncML/SynchronizationTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/SynchronizationTool.py?rev=24133&r1=24132&r2=24133&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/SynchronizationTool.py (original)
+++ erp5/trunk/products/ERP5SyncML/SynchronizationTool.py Fri Oct 10 12:43:33 2008
@@ -858,12 +858,13 @@
           #LOG('sendResponse, will start sendHttpResponse, xml', DEBUG, '')
           activity = self.getActivityType(domain=domain)
           self.activate(activity=activity,
-                          tag = domain.getId()).sendHttpResponse(
-                                           sync_id=sync_id,
-                                           to_url=to_url,
-                                           xml=xml,
-                                           domain_path=domain.getPath(),
-                                           content_type=content_type)
+                        tag=domain.getId(),
+                        priority=self.PRIORITY).sendHttpResponse(
+                                              sync_id=sync_id,
+                                              to_url=to_url,
+                                              xml=xml,
+                                              domain_path=domain.getPath(),
+                                              content_type=content_type)
         elif to_url.find('file://') == 0:
           filename = to_url[len('file:/'):]
           stream = file(filename,'w')
@@ -939,12 +940,13 @@
     except socket.error, msg:
       activity = self.getActivityType(domain=domain)
       self.activate(activity=activity,
-                        tag = domain.getId()).sendHttpResponse(
-                                              to_url=to_url,
-                                              sync_id=sync_id,
-                                              xml=xml,
-                                              domain_path=domain.getPath(),
-                                              content_type=content_type)
+                    tag=domain.getId(),
+                    priority=self.PRIORITY).sendHttpResponse(
+                                                  to_url=to_url,
+                                                  sync_id=sync_id,
+                                                  xml=xml,
+                                                  domain_path=domain.getPath(),
+                                                  content_type=content_type)
       LOG('sendHttpResponse, socket ERROR:', INFO, msg)
       LOG('sendHttpResponse, url, data', INFO, (to_url, data))
       return
@@ -976,7 +978,8 @@
         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 @@
             #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 @@
               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 ' '

Modified: erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py?rev=24133&r1=24132&r2=24133&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py (original)
+++ erp5/trunk/products/ERP5SyncML/XMLSyncUtils.py Fri Oct 10 12:43:33 2008
@@ -1453,17 +1453,18 @@
         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 @@
       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 @@
     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']




More information about the Erp5-report mailing list