algoo / preview-generator

generates previews of files with cache management
https://pypi.org/project/preview-generator/
MIT License
228 stars 50 forks source link

Add Filelock mecanism to avoid create multiples same preview #187

Closed inkhey closed 4 years ago

inkhey commented 4 years ago

From https://github.com/algoo/preview-generator/issues/186 Metaticket (point 1)

When multiple preview of same unrequested file are done in a very short amount of time (or the first request take a big amount of time to generate preview), we may being in a case where a same preview is generated two time.

This can occuring with all builder but may be more noticeable with video builder as ffmpeg doesn't overwrite by default leaving this kind of log:

File
'/home/user/previews/e9368a18b5d41d4041f2b003cfc9c1b2-500x500-page0.jpeg'
already exists. Overwrite ? [y/N]

To solve this we need a filelock (multiprocess proof) per file which unallow us to generate multiple time a same preview.

inkhey commented 4 years ago

fixed by https://github.com/algoo/preview-generator/pull/188