Open kaedroho opened 6 years ago
You are right, it always runs, even if only title/tags were changed. No way to tell in save()
what was updated, so yes, a hash would come in handy.
Maybe you can query the current object in save method and inspect if the file field has changed. https://stackoverflow.com/questions/12461100/django-detecting-changed-imagefield-with-same-filename
@kaedroho Is there an issue in Wagtail for file hashing, is it likely that it'll be in wagtail some time soon?
Yep, there's a PR here: https://github.com/wagtail/wagtail/pull/4526
The document file hash will make it in Wagtail 2.4. So this could probably be looked at with the latest Wagtail master
Currently, it appears there's no check for whether the file has actually changed before rerunning textract so it probably reruns even if the user has only updated the title.
@gasman and I were discussing adding file hashing to Wagtail Images/Documents for cache-busting but might help solve this issue too.