New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purge static files on delete #2488
Purge static files on delete #2488
Conversation
After testing it is possible to create resource with distant link instead of local fs file, as well as an organization or reuse without a logo image. I added try except on delete or None verification. |
133c20c
to
37b7ffc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work 💪 A few comments below :p
There's one more case we need to handle I think: community resources files not associated to a dataset — this happens regularly because our creation process is f****. So we should:
- either strengthen the upload process: if a dataset is not selected, delete the file (not sure we can do that, it's pretty stateless)
- make a purge scheduled script for community resources files
Co-authored-by: Alexandre Bulté <alexandre@bulte.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resource = get_resource(key) | ||
resource.fs_filename = fs_filename | ||
resource.save() | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe delete the resource from the index at this point, but totally optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 what about when we replace a ressource? not sure we handle that case.
Co-authored-by: Alexandre Bulté <alexandre@bulte.net>
Co-authored-by: Alexandre Bulté <alexandre@bulte.net>
…to purgeStaticFileOnDelete
Script creatinf indexes for deletion
Deletion bash script
|
|
Co-authored-by: Alexandre Bulté <alexandre@bulte.net>
def migrate(db): | ||
log.info('Processing resources resources.') | ||
|
||
datasets = Dataset.objects() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datasets = Dataset.objects() | |
datasets = Dataset.objects().no_cache() |
Using this may avoid the current migration failure on demo. Use it on every query set below too.
…to purgeStaticFileOnDelete
No description provided.