Kill pool if interrupted/error.
This commit is contained in:
parent
a169bafdd8
commit
37b63f2a4a
@ -364,8 +364,13 @@ class Photo(object):
|
|||||||
# get number of cores on the system, and use all minus one
|
# get number of cores on the system, and use all minus one
|
||||||
num_of_cores = os.sysconf('SC_NPROCESSORS_ONLN') - 1
|
num_of_cores = os.sysconf('SC_NPROCESSORS_ONLN') - 1
|
||||||
pool = Pool(processes=num_of_cores)
|
pool = Pool(processes=num_of_cores)
|
||||||
|
|
||||||
|
try:
|
||||||
for size in Photo.thumb_sizes:
|
for size in Photo.thumb_sizes:
|
||||||
pool.apply_async(make_photo_thumbs, args = (self, original_path, thumb_path, size))
|
pool.apply_async(make_photo_thumbs, args = (self, original_path, thumb_path, size))
|
||||||
|
except:
|
||||||
|
pool.terminate()
|
||||||
|
|
||||||
pool.close()
|
pool.close()
|
||||||
pool.join()
|
pool.join()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user