[Erp5-report] r8023 - /spec/mandriva/2006.0/zope-TimerService/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 19 17:41:11 CEST 2006


Author: kevin
Date: Mon Jun 19 17:41:04 2006
New Revision: 8023

URL: http://svn.erp5.org?rev=8023&view=rev
Log:
Commit zope-TimerService-0.2-5mdk spec files and patches

Modified:
    spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch
    spec/mandriva/2006.0/zope-TimerService/zope-TimerService.spec

Modified: spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch
URL: http://svn.erp5.org/spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch?rev=8023&r1=8022&r2=8023&view=diff
==============================================================================
--- spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch (original)
+++ spec/mandriva/2006.0/zope-TimerService/TimerService-erp5.patch Mon Jun 19 17:41:04 2006
@@ -1,32 +1,25 @@
---- TimerService-0.2/TimerService/timerserver/TimerServer.py  2004-03-17 11:59:42.000000000 +0100
-+++ TimerService-0.2.patched/TimerService/timerserver/TimerServer.py  2005-10-31 11:13:54.733011411 +0100
-@@ -6,7 +6,10 @@
+--- TimerService-0.2/TimerService/timerserver/TimerServer.py	2004-03-17 11:59:42.000000000 +0100
++++ TimerService-0.2.patched/TimerService/timerserver/TimerServer.py	2006-03-01 16:39:53.000000000 +0100
+@@ -6,7 +6,7 @@
  import traceback
-
+ 
  import thread
 -import sys, os, errno, time
-+
 +import sys, os, errno, time, socket
-+
-+import ZPublisher.Client
  from StringIO import StringIO
  from zLOG import LOG, INFO
-
-@@ -14,9 +17,10 @@
+ 
+@@ -14,6 +14,7 @@
  from ZPublisher.BaseRequest import BaseRequest
  from ZPublisher.BaseResponse import BaseResponse
  from ZPublisher.HTTPRequest import HTTPRequest
 +from ZPublisher import Client
-
+ 
  class TimerServer:
--    def __init__(self, module, interval=600):
-+    def __init__(self, module, interval=5):
-         self.module = module
-
-         self.interval = interval
-@@ -35,6 +39,34 @@
+     def __init__(self, module, interval=600):
+@@ -35,6 +36,34 @@
              '\tInterval: %s seconds.\n'%(time.ctime(time.time()), interval))
-
+ 
      def run(self):
 +
 +        # wait until the zhttp_server exist in socket_map
@@ -58,59 +51,85 @@
 +
          module = self.module
          interval = self.interval
-
---- TimerService-0.2/TimerService/TimerService.py  2004-03-17 12:22:52.000000000 +0100
-+++ TimerService-0.2.patched/TimerService/TimerService.py  2005-10-31 11:40:01.328681204 +0100
-@@ -53,15 +53,16 @@
+ 
+--- TimerService-0.2/TimerService/TimerService.py	2004-03-17 12:22:52.000000000 +0100
++++ TimerService-0.2.patched/TimerService/TimerService.py	2006-03-01 16:51:02.000000000 +0100
+@@ -3,7 +3,7 @@
+ # Authors: Nik Kim <fafhrd at legco.biz> 
+ __version__ = '$Revision: 1.3 $'[11:-2]
+ 
+-import sys, time
++import sys, time, threading
+ from DateTime import DateTime
+ from Globals import InitializeClass
+ from OFS.SimpleItem import SimpleItem
+@@ -16,6 +16,8 @@
+ 
+ current_version = 1
+ 
++processing_lock = threading.Lock()
++
+ class TimerService(SimpleItem):
+     """ timer service, all objects that wants timer
+     event subscribe here """
+@@ -49,6 +51,12 @@
+ 
+     def process_timer(self, interval):
+         """ """
++        # Try to acquire a lock, to make sure we only run one processing at a
++        # time, and abort if another processing is currently running
++        acquired = processing_lock.acquire(0)
++        if not acquired:
++          return
++
+         subscriptions = [self.unrestrictedTraverse(path)
                           for path in self._subscribers]
-
-         tick = time.time()
--        prev_tick = tick - interval
--        next_tick = tick + interval
-+#        prev_tick = tick - interval
-+#        next_tick = tick + interval
-
+ 
+@@ -56,7 +64,7 @@
+         prev_tick = tick - interval
+         next_tick = tick + interval
+ 
 -        LOG('TimerService', INFO, 'Ttimer tick at %s\n'%time.ctime(tick))
 +#        LOG('TimerService', INFO, 'Ttimer tick at %s\n'%time.ctime(tick))
-
+ 
          for subscriber in subscriptions:
              try:
--                subscriber.process_timer(
--                    interval, DateTime(tick), DateTime(prev_tick), DateTime(next_tick))
-+#                subscriber.process_timer(
-+#                    interval, DateTime(tick), DateTime(prev_tick), DateTime(next_tick))
-+              subscriber.process_timer(tick, interval)
+@@ -65,6 +73,9 @@
              except:
                  LOG('TimerService', ERROR, 'Process timer error', error = sys.exc_info())
-
-@@ -76,6 +77,12 @@
-         if path not in subscribers:
+ 
++        # When processing is done, release the lock
++        processing_lock.release()
++
+     def subscribe(self, ob):
+         """ """
+         path = '/'.join(ob.getPhysicalPath())
+@@ -77,6 +88,12 @@
              subscribers.append(path)
              self._subscribers = subscribers
-+
+ 
 +    def unsubscribeByPath(self, path):
 +        subscribers = self._subscribers
 +        if path in subscribers:
 +            subscribers.remove(path)
 +            self._subscribers = subscribers
-
++
      def unsubscribe(self, ob):
          """ """
-@@ -94,12 +101,14 @@
-
+         path = '/'.join(ob.getPhysicalPath())
+@@ -94,12 +111,12 @@
+ 
      def manage_removeSubscriptions(self, no, REQUEST=None):
          """ """
 -        subs = self.listAllSubscriptions()
 +        subs = self.lisSubscriptions()
-+
-+        #LOG('asdd',INFO,subs)
-
+ 
          remove_list = [subs[n] for n in [int(n) for n in no]]
-
+ 
 -        for subs, event, fl in remove_list:
 -            self.unsubscribe( subs, event_type=event )
 +        for sub in remove_list:
 +            self.unsubscribeByPath(sub)
-
+ 
          if REQUEST is not None:
              REQUEST.RESPONSE.redirect('manage_viewSubscriptions')

Modified: spec/mandriva/2006.0/zope-TimerService/zope-TimerService.spec
URL: http://svn.erp5.org/spec/mandriva/2006.0/zope-TimerService/zope-TimerService.spec?rev=8023&r1=8022&r2=8023&view=diff
==============================================================================
--- spec/mandriva/2006.0/zope-TimerService/zope-TimerService.spec (original)
+++ spec/mandriva/2006.0/zope-TimerService/zope-TimerService.spec Mon Jun 19 17:41:04 2006
@@ -1,6 +1,6 @@
 %define product   TimerService
 %define version   0.2
-%define release   4
+%define release   5
 
 %define zope_home     %{_prefix}/lib/zope
 %define software_home %{zope_home}/lib/python
@@ -75,6 +75,9 @@
 
 #----------------------------------------------------------------------
 %changelog
+* Mon Mar 06 2006 Kevin Deldycke <kevin at nexedi.com> 0.2-5mdk
+- Integrate new patch (see http://dev.legco.biz/forums/products/zopescheduler/0003/ for more details)
+
 * Wed Feb 01 2006 Kevin Deldycke <kevin at nexedi.com> 0.2-4mdk
 - Give ownership to zope
 




More information about the Erp5-report mailing list