[PhotoFloat] Spring cleaning (video, preloading, threading, updated JS-libraries, etc)
Tom Talpey
tom at talpey.com
Sat Jun 6 02:26:01 CEST 2015
On 6/5/2015 3:49 PM, Joachim Tingvold wrote:
> On 5 Jun 2015, at 13:07, Tom Talpey wrote:
>>> Yes, that was a side effect when doing threaded thumbing. I never really
>>> bothered to look into it since I never use ^C (-:
>> Ok, I'll take a look when I have a chance. I find that I often get
>> errors during scans (missing metadata or permissions errors) so I
>> frequently interrupt to fix problems as it goes.
>
> Great. Let us know if/when you fix it (-:
Actually it's pretty simple, the exception just needs to wind back to
terminate the Pool threads, instead of throwing at the lower level.
There's probably a better way, but this one seems to work!
diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py
index 52ae647..249160a 100644
--- a/scanner/PhotoAlbum.py
+++ b/scanner/PhotoAlbum.py
@@ -364,8 +364,11 @@ class Photo(object):
# get number of cores on the system, and use all minus one
num_of_cores = os.sysconf('SC_NPROCESSORS_ONLN') - 1
pool = Pool(processes=num_of_cores)
- for size in Photo.thumb_sizes:
- pool.apply_async(make_photo_thumbs, args = (self,
original_path, thumb_path, size))
+ try:
+ for size in Photo.thumb_sizes:
+ pool.apply_async(make_photo_thumbs, args = (self, original_path,
thumb_path, size))
+ except:
+ pool.terminate()
pool.close()
pool.join()
More information about the PhotoFloat
mailing list