Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion readthedocs/projects/tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ def clean_project_resources(project, version=None, version_slug=None):
version_slug=version_slug,
)

# Remove imported files
# Remove imported files and pageviews faster
if version:
version.imported_files.all().delete()
version.page_views.all().delete()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also called when a version is deactivated, do we want to remove pageviews in that case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, tbh. I guess it's pretty aggressive, and might cause people to lose data?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to call these on Project.delete and Version.delete only

else:
project.imported_files.all().delete()
project.page_views.all().delete()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary called when a project is deleted, it's also called from the admin. I'd put this under the delete method only (most of this data can be recovered, but pageview can't).



@app.task()
Expand Down