Author: sleon
Date: 2006-01-16 06:26:37 +0000 (Mon, 16 Jan 2006)
New Revision: 7865

Modified:
   trunk/apps/freeviz/server.py
Log:
some optimizations

Modified: trunk/apps/freeviz/server.py
===================================================================
--- trunk/apps/freeviz/server.py        2006-01-15 23:15:25 UTC (rev 7864)
+++ trunk/apps/freeviz/server.py        2006-01-16 06:26:37 UTC (rev 7865)
@@ -17,7 +17,7 @@
        conns = 0 

 class Handler(Base):
-       
+       chunks = []     

        def run(self):
                con = db.get_con()              
@@ -25,16 +25,13 @@
                while 1:
                        Base.vlock.acquire()
                        print "Hanlding harvested data"
-                       try:
-                               for chunk in Base.chunks:
-       
-                                       handler.handle(chunk,trans)
-                               if Base.chunks: print "COMMITED"
-                       except Exception:
-                               Base.vlock.release()
-                       Base.chunks=[]
-                       print "Done"
+                       self.chunks = Base.chunks
+                       Base.chunks = []
                        Base.vlock.release()
+                       for chunk in self.chunks:
+                               handler.handle(chunk,trans)
+                       if self.chunks: print "COMMITED"
+                       self.chunks=[]
                        time.sleep(HANDLER_DELAY)                       

 class serv(Base):


Reply via email to