Author: mherger
Date: Mon Feb 22 23:33:51 2010
New Revision: 8547

URL: http://svn.slimdevices.com/jive?rev=8547&view=rev
Log:
Fixed Bug: 15651
Description: give SP air to breath when scanning large folders for images. Idle 
task every 100 items, check the max items inside the folder too.

Modified:
    
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceLocalStorage.lua

Modified: 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceLocalStorage.lua
URL: 
http://svn.slimdevices.com/jive/7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceLocalStorage.lua?rev=8547&r1=8546&r2=8547&view=diff
==============================================================================
--- 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceLocalStorage.lua
 (original)
+++ 
7.5/trunk/squeezeplay/src/squeezeplay/share/applets/ImageViewer/ImageSourceLocalStorage.lua
 Mon Feb 22 23:33:51 2010
@@ -63,12 +63,20 @@
        self.task = Task("scanImageFolder", self, function()
                local dirstoscan = { folder }
                local dirsscanned= {}
+               local x = 0
        
                for i, nextfolder in pairs(dirstoscan) do
 
                        if not dirsscanned[nextfolder] then
                        
                                for f in lfs.dir(nextfolder) do
+
+                                       -- idle this task after every 100 items 
                        
+                                       x = x+1
+                                       if x > 100 then
+                                               x = 0
+                                               self.task:yield()
+                                       end
                                
                                        -- exclude any dot file (hidden 
files/directories)
                                        if (string.sub(f, 1, 1) ~= ".") then
@@ -92,6 +100,11 @@
                                                end
                                        
                                        end
+
+                                       -- 1000 images should be enough...
+                                       if #self.imgFiles > 1000 then
+                                               break
+                                       end
                                end
                                
                                -- don't scan this folder twice - just in case

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to