[csw-devel] SF.net SVN: gar:[20508] csw/mgar/gar/v2/lib/python/models.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Mar 23 21:33:16 CET 2013


Revision: 20508
          http://gar.svn.sourceforge.net/gar/?rev=20508&view=rev
Author:   wahwah
Date:     2013-03-23 20:33:15 +0000 (Sat, 23 Mar 2013)
Log Message:
-----------
pkgdb: Don't cache anything in sqlobject instances

These instances seem to be kept around by sqlobject, so if we bind larger
amounts of data to them, we run out of memory.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/models.py

Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py	2013-03-23 14:58:47 UTC (rev 20507)
+++ csw/mgar/gar/v2/lib/python/models.py	2013-03-23 20:33:15 UTC (rev 20508)
@@ -163,7 +163,6 @@
 
   def __init__(self, *args, **kwargs):
     super(Srv4FileStats, self).__init__(*args, **kwargs)
-    self._cached_pkgstats = None
 
   def DeleteAllDependentObjects(self):
     data_obj = self.data_obj
@@ -247,22 +246,21 @@
     return s
 
   def GetStatsStruct(self):
-    if not self._cached_pkgstats:
-      self._cached_pkgstats = cPickle.loads(str(self.data_obj.pickle))
-      # There was a problem with bad utf-8 in the VENDOR field.
-      # This is a workaround.
-      if "VENDOR" in self._cached_pkgstats["pkginfo"]:
-        self._cached_pkgstats["pkginfo"]["VENDOR"] = self.GetUnicodeOrNone(
-            self._cached_pkgstats["pkginfo"]["VENDOR"])
-      # The end of the hack.
-      #
-      # One more workaround
-      for d in self._cached_pkgstats["pkgmap"]:
-        if "path" in d:
-          d["path"] = self.GetUnicodeOrNone(d["path"])
-          d["line"] = self.GetUnicodeOrNone(d["line"])
-      # End of the workaround
-    return self._cached_pkgstats
+    pkgstats = cPickle.loads(str(self.data_obj.pickle))
+    # There was a problem with bad utf-8 in the VENDOR field.
+    # This is a workaround.
+    if "VENDOR" in pkgstats["pkginfo"]:
+      pkgstats["pkginfo"]["VENDOR"] = self.GetUnicodeOrNone(
+          pkgstats["pkginfo"]["VENDOR"])
+    # The end of the hack.
+    #
+    # One more workaround
+    for d in pkgstats["pkgmap"]:
+      if "path" in d:
+        d["path"] = self.GetUnicodeOrNone(d["path"])
+        d["line"] = self.GetUnicodeOrNone(d["line"])
+    # End of the workaround
+    return pkgstats
 
   def _GetBuildSource(self):
     data = self.GetStatsStruct()

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list