[Checkins] SVN: z3c.image/trunk/src/z3c/image/proc/adapter.py take
care about open file limit in cache
Bernd Dorn
bernd.dorn at fhv.at
Sun Oct 22 14:52:05 EDT 2006
Log message for revision 70884:
take care about open file limit in cache
Changed:
U z3c.image/trunk/src/z3c/image/proc/adapter.py
-=-
Modified: z3c.image/trunk/src/z3c/image/proc/adapter.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/adapter.py 2006-10-22 17:59:47 UTC (rev 70883)
+++ z3c.image/trunk/src/z3c/image/proc/adapter.py 2006-10-22 18:52:04 UTC (rev 70884)
@@ -9,10 +9,16 @@
from PIL import ImageFile, Image
from types import StringType
from zope.app.cache.ram import RAMCache
-
+import os
+try:
+ maxEntries = int(os.popen('ulimit -n').read().strip()) - 10
+except:
+ maxEntries = 500
+
# see http://mail.python.org/pipermail/image-sig/2003-May/002228.html
ImageFile.MAXBLOCK = 1024*1024*10
imgCache = RAMCache()
+imgCache.maxEntries = maxEntries
class ProcessableImage(object):
@@ -85,11 +91,7 @@
for name,args,kwords in self.cmds:
func = getattr(pimg,name)
pimg = func(*args,**kwords)
+
img = self._toImage(pimg, quality=quality, optimize=optimize)
imgCache.set(img, self.context, key=key)
return img
-
-
-
-
-
More information about the Checkins
mailing list